diff options
author | Matthew Newhook <matthew@zeroc.com> | 2002-03-13 18:19:00 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2002-03-13 18:19:00 +0000 |
commit | c5ecc3026bff01b4ac2406df9600dff2937d4865 (patch) | |
tree | 391096a4c7a02685f7377ae685b49e41c0f4189d /java/demo/Freeze/library/LibraryI.java | |
parent | Updates (diff) | |
download | ice-c5ecc3026bff01b4ac2406df9600dff2937d4865.tar.bz2 ice-c5ecc3026bff01b4ac2406df9600dff2937d4865.tar.xz ice-c5ecc3026bff01b4ac2406df9600dff2937d4865.zip |
cleanup
Diffstat (limited to 'java/demo/Freeze/library/LibraryI.java')
-rw-r--r-- | java/demo/Freeze/library/LibraryI.java | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/java/demo/Freeze/library/LibraryI.java b/java/demo/Freeze/library/LibraryI.java index f66cbf6f2cc..0479a948267 100644 --- a/java/demo/Freeze/library/LibraryI.java +++ b/java/demo/Freeze/library/LibraryI.java @@ -10,12 +10,6 @@ class LibraryI extends _LibraryDisp { - private BookPrx - isbnToBook(String isbn) - { - return BookPrxHelper.uncheckedCast(_adapter.createProxy(BookI.createIdentity(isbn))); - } - public synchronized BookPrx createBook(BookDescription description, Ice.Current current) throws DatabaseException, BookExistsException @@ -41,10 +35,10 @@ class LibraryI extends _LibraryDisp // // Create a new book Servant. // - BookI bookI = new BookI(this, _evictor); + BookI bookI = new BookI(this); bookI._description = description; - Ice.Identity ident = BookI.createIdentity(description.isbn); + Ice.Identity ident = createBookIdentity(description.isbn); // // Create a new Ice Object in the evictor, using the new @@ -213,6 +207,13 @@ class LibraryI extends _LibraryDisp _authors.fastPut(description.authors, newIsbnSeq); } + + // + // This can throw EvictorDeactivatedException (which + // indicates an internal error). The exception is + // currently ignored. + // + _evictor.destroyObject(createBookIdentity(description.isbn)); } catch(Freeze.DBException ex) { @@ -229,6 +230,26 @@ class LibraryI extends _LibraryDisp _authors = new StringIsbnSeqDict(db); } + private Ice.Identity + createBookIdentity(String isbn) + { + // + // Note that the identity category is important since the + // locator was installed for the category 'book'. + // + Ice.Identity ident = new Ice.Identity(); + ident.category = "book"; + ident.name = isbn; + + return ident; + } + + private BookPrx + isbnToBook(String isbn) + { + return BookPrxHelper.uncheckedCast(_adapter.createProxy(createBookIdentity(isbn))); + } + private Ice.ObjectAdapter _adapter; private Freeze.Evictor _evictor; private StringIsbnSeqDict _authors; |