1 package org.objectweb.perseus.concurrency.distributed.globallock.lib; 2 3 4 27 28 29 import org.objectweb.perseus.distribution.api.DistResCoordinator; 30 import org.objectweb.perseus.distribution.api.DistResCoordinatorService; 31 import org.objectweb.perseus.distribution.api.DistResCoordinatorFactory; 32 import org.objectweb.perseus.concurrency.distributed.globallock.lib.GlobalLockCoordinator; 33 import org.objectweb.perseus.concurrency.lib.LockValue; 34 import org.objectweb.perseus.concurrency.lib.RWLockValue; 35 36 import java.io.Serializable ; 37 38 41 42 public class GlobalLockCoordinatorFactory implements DistResCoordinatorFactory { 43 LockValue lockValue; 44 public GlobalLockCoordinatorFactory() { 45 this(new RWLockValue()); 46 } 47 public GlobalLockCoordinatorFactory(LockValue lockValue) { 48 this.lockValue = lockValue; 49 } 50 public DistResCoordinator newCoordinator(DistResCoordinatorService drcs, 51 Serializable nodeId, Object copy, 52 Object resId) { 53 GlobalLockCoordinator glc; 54 55 if (copy == null) { 56 glc = new GlobalLockCoordinator(resId, drcs, lockValue); 57 } else { 58 glc = (GlobalLockCoordinator) copy; 59 glc.initCopy(resId, drcs, lockValue); 60 } 61 62 return glc; 63 } 64 } 65 | Popular Tags |