1 package org.objectweb.perseus.concurrency.distributed.globallock; 2 3 import org.objectweb.perseus.distribution.api.DistResUser; 4 import java.io.Serializable ; 5 6 public class UserInterceptor implements DistResUser { 7 DistResUser dru; 8 GlobalLockInterceptor.FailureListener failureListener; 9 Serializable nodeId; 10 11 public UserInterceptor(DistResUser dru, Serializable nodeId) { 12 this.dru = dru; 13 this.nodeId = nodeId; 14 } 15 16 public void receive(Serializable resId, Serializable message) { 17 dru.receive(resId, message); 18 } 19 20 public Serializable getState(Serializable resId) { 21 Serializable ret = dru.getState(resId); 22 if (failureListener != null) 23 failureListener.handle(resId, nodeId); 24 return ret; 25 } 26 27 public void setFailureListener(GlobalLockInterceptor.FailureListener failureListener) { 28 this.failureListener = failureListener; 29 } 30 } 31 | Popular Tags |