|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tp.impl.CSEP545ServiceObject
public abstract class CSEP545ServiceObject
A stub class to drive project services.
init(String[])
initStorage()
if initializing the storage or recovery()
if storage existsstartUp()
Registry.rebind(String, Remote)
readyToServe()
Argument | Description | Default |
---|---|---|
-n name or --name name |
the name of service | Type of service |
-p port or --port port |
port number to bind the service | anonymous port |
-d dir or --dir dir |
the data directory where all necessary files are. | './' ServiceID '-data' |
--init |
initialize the data directory.
will wipe out data directory if it exists.
initialize if data directory does not exist,
recovery() otherwise. |
Do not force initialization |
--rmiHost host |
host name of RMI registry | 127.0.0.1 |
--rmiPort port |
port number of RMI registry. | 1099 |
-c URI or --code URI |
RMI server code base URL | http://127.0.0.1:8080/csep545.jar |
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface tp.impl.CSEP545Service |
---|
CSEP545Service.Type |
Field Summary | |
---|---|
protected File |
dir
directory to store all data files |
protected Registry |
registry
reference to RMI registry |
protected ServiceID |
svcid
service identifier. |
Constructor Summary | |
---|---|
CSEP545ServiceObject()
|
Method Summary | ||
---|---|---|
File |
getDataRoot()
Get root directory where local data files are located. |
|
ServiceID |
getServiceID()
Name of remote service object |
|
protected abstract void |
init(String[] args)
IMPLEMENT THIS METHOD process command line parameters and setup any parameterized values. |
|
protected abstract void |
initStorage()
IMPLEMENT THIS METHOD Initialize necessary data files. |
|
void |
kill()
Immediately kill remote service. |
|
protected
|
lookupRemote(CSEP545Service.Type type)
|
|
protected
|
lookupRemote(CSEP545Service.Type type,
String name)
utility method to resolve remote object |
|
protected
|
lookupRemote(ServiceID id)
utility method to resolve remote object |
|
protected
|
lookupRemote(String name)
utility method to resolve remote object |
|
static void |
main(String[] args)
|
|
protected abstract void |
readyToServe()
IMPLEMENT THIS METHOD Bootstrapping completed and the server is up and running. |
|
protected abstract void |
recovery()
IMPLEMENT THIS METHOD Run recovery algorithm and reconstruct the state of service before failure. |
|
void |
shutdown()
Gracefully shutdown target service. |
|
protected abstract void |
startUp()
IMPLEMENT THIS METHOD If you use extra threads in your service, start them in this method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface tp.impl.CSEP545Service |
---|
refresh |
Field Detail |
---|
protected ServiceID svcid
protected File dir
protected transient Registry registry
Constructor Detail |
---|
public CSEP545ServiceObject()
Method Detail |
---|
public final void kill() throws RemoteException
CSEP545Service
kill
in interface CSEP545Service
RemoteException
public void shutdown() throws RemoteException
CSEP545Service
Registry.unbind(String)
shutdown
in interface CSEP545Service
RemoteException
Registry.unbind(String)
public final ServiceID getServiceID()
CSEP545Service
getServiceID
in interface CSEP545Service
public final File getDataRoot()
getServiceID()
'-data' under working directory.
protected abstract void init(String[] args) throws Exception
args
- command line arguments except common arguments
Exception
protected abstract void initStorage() throws Exception
RM
and commit log file for TM
Exception
protected abstract void recovery() throws Exception
Exception
protected abstract void startUp() throws Exception
Exception
protected abstract void readyToServe() throws Exception
Exception
protected <T extends Remote> T lookupRemote(String name) throws AccessException, RemoteException, NotBoundException
name
- bind name of remote object
AccessException
RemoteException
NotBoundException
protected <T extends Remote> T lookupRemote(ServiceID id) throws AccessException, RemoteException, NotBoundException
id
- bind name of remote object
AccessException
RemoteException
NotBoundException
protected <T extends Remote> T lookupRemote(CSEP545Service.Type type, String name) throws AccessException, RemoteException, NotBoundException
type
- type of remove object
AccessException
RemoteException
NotBoundException
protected <T extends Remote> Map<String,T> lookupRemote(CSEP545Service.Type type) throws AccessException, RemoteException, NotBoundException
AccessException
RemoteException
NotBoundException
public static void main(String[] args) throws Exception
args
-
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |