com.sun.jini.thread
Class ReadyState
java.lang.Object
com.sun.jini.thread.ReadyState
public class ReadyState
- extends Object
Utility class used to prevent access to a service before it has completed
its initialization or after it starts to shutdown. Each public entry point
to the service should call check
or shutdown
,
and initialization should call ready
when the service is ready
to use.
- Since:
- 2.1
- Author:
- Sun Microsystems, Inc.
Nested Class Summary |
private static class |
ReadyState.RemoteExceptionWrapper
Wrapper used to prevent a RemoteException from being
wrapped in a ServerException by the RMI implementation. |
Method Summary |
void |
check()
Checks if the service is ready to use, waiting if it is
initializing, and throwing NoSuchObjectException if it is
shutting down. |
void |
ready()
Marks the service ready for use. |
void |
shutdown()
Marks the service as shutting down, waiting if it is initializing,
and throwing NoSuchObjectException if it is already
shutting down. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INITIALIZE
private static final int INITIALIZE
- See Also:
- Constant Field Values
READY
private static final int READY
- See Also:
- Constant Field Values
SHUTDOWN
private static final int SHUTDOWN
- See Also:
- Constant Field Values
state
private int state
ReadyState
public ReadyState()
check
public void check()
- Checks if the service is ready to use, waiting if it is
initializing, and throwing
NoSuchObjectException
if it is
shutting down. Note that the NoSuchObjectException
will be
wrapped in a RemoteExceptionWrapper
.
ready
public void ready()
- Marks the service ready for use. This method should only be called
from the code that performs the service initialization, and it should
only be called once.
shutdown
public void shutdown()
- Marks the service as shutting down, waiting if it is initializing,
and throwing
NoSuchObjectException
if it is already
shutting down. Note that the NoSuchObjectException
will be
wrapped in a RemoteExceptionWrapper
.
Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.