pub fn handle_message(&mut self, a : uint, b : JavaObjectId, op : RemoteObjectOpMessage) {
		// TODO: owns() is not necessarily satisfied if we send back objects without being asked for
		assert!(self.owns(b));
		match op {
			REMOTE_WHO_OWNS => fail!("logic error, WHO_OWNS is not handled by threads"),
			REMOTE_ADD_REF => self.add_ref(b),
			REMOTE_RELEASE => self.release(b),
			REMOTE_OWN(mode) => {
				match mode {
					OBJECT_ACCESS_Monitor | OBJECT_ACCESS_MonitorPriority => {
						let obj = self.owned_objects.get_mut(&b);

						// we should assume that, in order to request Priority access,
						// the sender thread should already own the monitor as is
						// the requirement for calling wait() on an object.
						assert!(mode != OBJECT_ACCESS_MonitorPriority || 
							obj.monitor().is_locked_by_thread(a));

						if !obj.monitor().can_be_locked_by_thread(a) {
							// append the thread to the monitor's waiting queues
							obj.monitor_mut().push_thread(a, 
								mode == OBJECT_ACCESS_MonitorPriority
							);

							return;
						}
					},
					// fallthru
					_ => (),
				}
				self.send_to_thread(b, a);
			},
			
			REMOTE_DISOWN(obj,rec) => {
				// currently we should not be receiving objects that we
				// did not request using OB_RQ_OWN
				assert_eq!(rec, self.tid);
				self.owned_objects.insert(b, obj);
			},
		}
	}
// ----------------------------------------------
// Handle any of the remote object messages 
// a is the source thread id, and b is the object in question.
Handle any of the remote object messages
a is the source thread id, and b is the object in question.
Handle any of the remote object messages a is the source thread id and b is the object in question .
pub fn handle_message(&mut self, a : uint, b : JavaObjectId, op : RemoteObjectOpMessage) {
		// TODO: owns() is not necessarily satisfied if we send back objects without being asked for
		assert!(self.owns(b));
		match op {
			REMOTE_WHO_OWNS => fail!("logic error, WHO_OWNS is not handled by threads"),
			REMOTE_ADD_REF => self.add_ref(b),
			REMOTE_RELEASE => self.release(b),
			REMOTE_OWN(mode) => {
				match mode {
					OBJECT_ACCESS_Monitor | OBJECT_ACCESS_MonitorPriority => {
						let obj = self.owned_objects.get_mut(&b);
						// we should assume that, in order to request Priority access,
						// the sender thread should already own the monitor as is
						// the requirement for calling wait() on an object.
						assert!(mode != OBJECT_ACCESS_MonitorPriority || 
							obj.monitor().is_locked_by_thread(a));
						if !obj.monitor().can_be_locked_by_thread(a) {
							// append the thread to the monitor's waiting queues
							obj.monitor_mut().push_thread(a, 
								mode == OBJECT_ACCESS_MonitorPriority
							);
							return;
						}
					},
					// fallthru
					_ => (),
				}
				self.send_to_thread(b, a);
			},
			REMOTE_DISOWN(obj,rec) => {
				// currently we should not be receiving objects that we
				// did not request using OB_RQ_OWN
				assert_eq!(rec, self.tid);
				self.owned_objects.insert(b, obj);
			},
		}
	}
pub fn handle_message ( & mut self , a : uint , b : JavaObjectId , op : RemoteObjectOpMessage ) { // TODO: owns() is not necessarily satisfied if we send back objects without being asked for assert ! ( self owns ( b ) ) ; match op { REMOTE_WHO_OWNS => fail ! ( " " ) , REMOTE_ADD_REF => self . add_ref ( b ) , REMOTE_RELEASE => self . release ( b ) , REMOTE_OWN ( mode ) => { match mode { OBJECT_ACCESS_Monitor | OBJECT_ACCESS_MonitorPriority => { let obj = self . owned_objects . get_mut ( & b ) ; // we should assume that, in order to request Priority access, // the sender thread should already own the monitor as is // the requirement for calling wait() on an object. assert ! ( mode OBJECT_ACCESS_MonitorPriority obj monitor ( ) is_locked_by_thread ( a ) ) ; if ! obj . monitor ( ) . can_be_locked_by_thread ( a ) { // append the thread to the monitor's waiting queues obj . monitor_mut ( ) . push_thread ( a , mode == OBJECT_ACCESS_MonitorPriority ) ; return ; } } , // fallthru _ => ( ) , } self . send_to_thread ( b , a ) ; } , REMOTE_DISOWN ( obj , rec ) => { // currently we should not be receiving objects that we // did not request using OB_RQ_OWN assert_eq ! ( rec self tid ) ; self . owned_objects . insert ( b , obj ) ; } , } }
Handle any of the remote object messages
a is the source thread id, and b is the object in question.
Handle any of the remote object messages a is the source thread id and b is the object in question .
&mut self
a
uint
b
JavaObjectId
op
RemoteObjectOpMessage