diff options
author | Jose <jose@zeroc.com> | 2017-04-21 23:53:16 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2017-04-21 23:53:16 +0200 |
commit | 97fa3c7f66b7f7a2612499b54085d27f4d7bf3f0 (patch) | |
tree | ee6200df511e84d553a14dcf3b9a171bc017d81f /java-compat/src | |
parent | Changed default ctor of CommunicatorHolder (diff) | |
download | ice-97fa3c7f66b7f7a2612499b54085d27f4d7bf3f0.tar.bz2 ice-97fa3c7f66b7f7a2612499b54085d27f4d7bf3f0.tar.xz ice-97fa3c7f66b7f7a2612499b54085d27f4d7bf3f0.zip |
Fix (ICE-7780) - Glacier2::Application cleanup
Diffstat (limited to 'java-compat/src')
-rw-r--r-- | java-compat/src/Glacier2/src/main/java/Glacier2/Application.java | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/java-compat/src/Glacier2/src/main/java/Glacier2/Application.java b/java-compat/src/Glacier2/src/main/java/Glacier2/Application.java index 73aae614e9f..9dd6d32bd3e 100644 --- a/java-compat/src/Glacier2/src/main/java/Glacier2/Application.java +++ b/java-compat/src/Glacier2/src/main/java/Glacier2/Application.java @@ -48,7 +48,7 @@ public abstract class Application extends Ice.Application /** * This exception is raised if the session should be restarted. */ - public class RestartSessionException extends Exception + public static class RestartSessionException extends Exception { } @@ -74,6 +74,17 @@ public abstract class Application extends Ice.Application } /** + * Creates a new Glacier2 session. A call to + * <code>createSession</code> always precedes a call to + * <code>runWithSession</code>. If <code>Ice.LocalException</code> + * is thrown from this method, the application is terminated. + * + * @return The Glacier2 session. + **/ + abstract public Glacier2.SessionPrx + createSession(); + + /** * Called once the communicator has been initialized and the Glacier2 session * has been established. A derived class must implement <code>runWithSession</code>, * which is the application's starting method. @@ -95,6 +106,18 @@ public abstract class Application extends Ice.Application throws RestartSessionException; /** + * Called when the session refresh thread detects that the session has been + * destroyed. A subclass can override this method to take action after the + * loss of connectivity with the Glacier2 router. This method is called + * according to the Ice invocation dipsatch rules (in other words, it + * uses the same rules as an servant upcall or AMI callback). + **/ + public void + sessionDestroyed() + { + } + + /** * Run should not be overridden for Glacier2.Application. Instead * <code>runWithSession</code> should be used. */ @@ -114,7 +137,7 @@ public abstract class Application extends Ice.Application * * @throws RestartSessionException This exception is always thrown. **/ - public void + public static void restart() throws RestartSessionException { @@ -122,29 +145,6 @@ public abstract class Application extends Ice.Application } /** - * Creates a new Glacier2 session. A call to - * <code>createSession</code> always precedes a call to - * <code>runWithSession</code>. If <code>Ice.LocalException</code> - * is thrown from this method, the application is terminated. - * - * @return The Glacier2 session. - **/ - abstract public Glacier2.SessionPrx - createSession(); - - /** - * Called when the session refresh thread detects that the session has been - * destroyed. A subclass can override this method to take action after the - * loss of connectivity with the Glacier2 router. This method is called - * according to the Ice invocation dipsatch rules (in other words, it - * uses the same rules as an servant upcall or AMI callback). - **/ - public void - sessionDestroyed() - { - } - - /** * Returns the Glacier2 router proxy * @return The router proxy. **/ @@ -171,7 +171,7 @@ public abstract class Application extends Ice.Application * @return The category. * @throws SessionNotExistException No session exists. **/ - public String + public static String categoryForClient() throws SessionNotExistException { @@ -189,7 +189,7 @@ public abstract class Application extends Ice.Application * @return The identity with the given name and a unique category. * @throws SessionNotExistException No session exists. **/ - public Ice.Identity + public static Ice.Identity createCallbackIdentity(String name) throws SessionNotExistException { @@ -202,7 +202,7 @@ public abstract class Application extends Ice.Application * @return The proxy for the servant. * @throws SessionNotExistException No session exists. **/ - public Ice.ObjectPrx + public static Ice.ObjectPrx addWithUUID(Ice.Object servant) throws SessionNotExistException { @@ -214,7 +214,7 @@ public abstract class Application extends Ice.Application * @return The object adapter. * @throws SessionNotExistException No session exists. */ - public Ice.ObjectAdapter + public static Ice.ObjectAdapter objectAdapter() throws SessionNotExistException { @@ -223,7 +223,7 @@ public abstract class Application extends Ice.Application throw new SessionNotExistException(); } - synchronized(this) + synchronized(_mutex) { if(_adapter == null) { @@ -285,6 +285,7 @@ public abstract class Application extends Ice.Application boolean restart = false; status.value = 0; + boolean sessionCreated = false; try { @@ -312,7 +313,7 @@ public abstract class Application extends Ice.Application try { _session = createSession(); - _createdSession = true; + sessionCreated = true; } catch(Ice.LocalException ex) { @@ -320,7 +321,7 @@ public abstract class Application extends Ice.Application status.value = 1; } - if(_createdSession) + if(sessionCreated) { int acmTimeout = 0; try @@ -438,7 +439,7 @@ public abstract class Application extends Ice.Application } } - if(_createdSession && _router != null) + if(sessionCreated && _router != null) { try { @@ -489,7 +490,6 @@ public abstract class Application extends Ice.Application _adapter = null; _router = null; _session = null; - _createdSession = false; _category = null; return restart; @@ -498,6 +498,5 @@ public abstract class Application extends Ice.Application private static Ice.ObjectAdapter _adapter; private static Glacier2.RouterPrx _router; private static Glacier2.SessionPrx _session; - private static boolean _createdSession = false; private static String _category; } |