1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
public void bind(java.lang.String $param_String_1, java.rmi.Remote $param_Remote_2) throws java.rmi.AccessException, java.rmi.AlreadyBoundException, java.rmi.RemoteException { try { if (useNewInvoke) { ref.invoke( this , $method_bind_0, new java.lang.Object[] {$param_String_1, $param_Remote_2}, 7583982177005850366L); } else { java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this , operations, 0 , interfaceHash); try { java.io.ObjectOutput out = call.getOutputStream(); out.writeObject($param_String_1); out.writeObject($param_Remote_2); } catch (java.io.IOException e) { throw new java.rmi.MarshalException( "error marshalling arguments" , e); } ref.invoke(call); ref.done(call); } } catch (java.lang.RuntimeException e) { throw e; } catch (java.rmi.RemoteException e) { throw e; } catch (java.rmi.AlreadyBoundException e) { throw e; } catch (java.lang.Exception e) { throw new java.rmi.UnexpectedException( "undeclared checked exception" , e); } } |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
public StreamRemoteCall(Connection c, ObjID id, int op, long hash) throws RemoteException { try { conn = c; Transport.transportLog.log(Log.VERBOSE, "write remote call header..." ); // write out remote call header info... // call header, part 1 (read by Transport) conn.getOutputStream().write(TransportConstants.Call); getOutputStream(); // creates a MarshalOutputStream id.write(out); // object id (target of call) // call header, part 2 (read by Dispatcher) out.writeInt(op); // method number (operation index) out.writeLong(hash); // stub/skeleton hash } catch (IOException e) { throw new MarshalException( "Error marshaling call header" , e); } } |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
public boolean serviceCall( final RemoteCall call) { try { final Remote impl; ObjID id; try { id = ObjID.read(call.getInputStream()); } catch (java.io.IOException e) { throw new MarshalException( "unable to read objID" , e); } /* get the remote object */ Transport transport = id.equals(dgcID) ? null : this; Target target = ObjectTable.getTarget(new ObjectEndpoint(id, transport)); if (target == null || (impl = target.getImpl()) == null) { throw new NoSuchObjectException("no such object in table"); } final Dispatcher disp = target.getDispatcher(); target.incrementCallCount(); try { /* call the dispatcher */ transportLog.log(Log.VERBOSE, "call dispatcher"); final AccessControlContext acc = target.getAccessControlContext(); ClassLoader ccl = target.getContextClassLoader(); Thread t = Thread.currentThread(); ClassLoader savedCcl = t.getContextClassLoader(); try { t.setContextClassLoader(ccl); currentTransport.set(this); try { java.security.AccessController.doPrivileged( new java.security.PrivilegedExceptionAction<Void>() { public Void run() throws IOException { checkAcceptPermission(acc); disp.dispatch(impl, call); return null; } }, acc); } catch (java.security.PrivilegedActionException pae) { throw (IOException) pae.getException(); } } finally { t.setContextClassLoader(savedCcl); currentTransport.set(null); } } catch (IOException ex) { transportLog.log(Log.BRIEF, "exception thrown by dispatcher: ", ex); return false; } finally { target.decrementCallCount(); } } catch (RemoteException e) { // if calls are being logged, write out exception if (UnicastServerRef.callLog.isLoggable(Log.BRIEF)) { // include client host name if possible String clientHost = ""; try { clientHost = "[" + RemoteServer.getClientHost() + "] "; } catch (ServerNotActiveException ex) { } String message = clientHost + "exception: "; UnicastServerRef.callLog.log(Log.BRIEF, message, e); } /* We will get a RemoteException if either a) the objID is * not readable, b) the target is not in the object table, or * c) the object is in the midst of being unexported (note: * NoSuchObjectException is thrown by the incrementCallCount * method if the object is being unexported). Here it is * relatively safe to marshal an exception to the client * since the client will not have seen a return value yet. */ try { ObjectOutput out = call.getResultStream( false ); UnicastServerRef.clearStackTraces(e); out.writeObject(e); call.releaseOutputStream(); } catch (IOException ie) { transportLog.log(Log.BRIEF, "exception thrown marshalling exception: " , ie); return false ; } } return true ; } |
1
|
id = ObjID.read(call.getInputStream()); |
1
2
3
|
Target target = ObjectTable.getTarget( new ObjectEndpoint(id, transport)); impl = target.getImpl() |
1
|
disp.dispatch(impl, call); |