Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adding missing handler when a restart crash.
[hpcvm.git] / src / and / hpcvm / ConnectedClient.java
1 package and.hpcvm;
2
3 import java.io.Serializable;
4 import java.rmi.RemoteException;
5
6 public class ConnectedClient implements Serializable
7 {
8         private static final long serialVersionUID = 1L;
9         private ServicesClient stub ;
10         private int timeout ;
11         private Status state ;
12         private String ip ;
13         private String name ;
14         private ComputingClient cl ;
15
16         ConnectedClient( ServicesClient _stub )
17         {
18                 stub = _stub ;
19                 timeout = 0 ;
20                 state = new Status() ;
21                 state.setStatus( "connected" ) ;
22                 try {
23                         ip = stub.getIPHost() ;
24                         name = stub.getName() ;
25                 } catch (RemoteException e) {
26                         e.printStackTrace();
27                 }
28                 cl = null ;
29         }
30         
31         protected boolean getFail() 
32         {
33                 if( cl != null )
34                 {
35                         return cl.getFail() ;
36                 }
37                 
38                 return false ;
39         }
40
41         protected void setFail( boolean _b )
42         {
43                 if( cl != null )
44                 {
45                         cl.setFail( _b ) ;
46                 }
47         }
48         
49         protected ServicesClient getStub() { return stub ; }
50
51         protected void setStub( ServicesClient _stub ) { stub = _stub ; }
52
53         protected int getTimeout() { return timeout ; }
54
55         protected void incTimeout() { timeout++ ; }
56
57         protected void resetTimeout() { timeout = 0 ; }
58
59         protected String getStatus() { return state.getStatus() ; }
60
61         protected void setStatus( String _state ) { state.setStatus( _state ) ; }
62
63         protected String getIP() { return ip ; }
64
65         protected String getName() { return name ; } ;
66
67         protected void setComputingClient( ComputingClient _cl ) { cl = _cl ; }
68
69         protected ComputingClient getComputingClient() { return cl ; } 
70 }