public static DSOContext createStandaloneContext(String configSpec, ClassLoader loader, boolean expressRejoinClient, TCSecurityManager securityManager, SecurityInfo securityInfo, ProductID productId) { ManagerImpl manager = new ManagerImpl(true, null, null, null, null, null, null, true, loader, expressRejoinClient, securityManager, productId); return createContext(manager, configSpec, securityManager, securityInfo); }
@Override public void unlock(final LockID lock, final LockLevel level) throws AbortedOperationException { if (clusteredLockingEnabled(lock)) { // LockManager Unlock callback will be called on commit of current transaction by txnManager. this.txManager.commit(lock, level, false, getUnlockCallback(lock, level)); } }
@Override public void logicalInvokeWithTransaction(final Object object, final Object lockObject, final String methodName, final Object[] params) throws AbortedOperationException { final LockID lock = generateLockIdentifier(lockObject); lock(lock, LockLevel.WRITE); try { logicalInvoke(object, methodName, params); } finally { unlock(lock, LockLevel.WRITE); } }
@Override public void logicalInvoke(final Object object, final String methodSignature, final Object[] params) { final Manageable m = (Manageable) object; if (m.__tc_managed() != null) { final TCObject tco = lookupExistingOrNull(object); try { if (tco != null) { if (SerializationUtil.ADD_ALL_SIGNATURE.equals(methodSignature)) { logicalAddAllInvoke(this.serializer.methodToID(methodSignature), methodSignature, (Collection) params[0], tco); } else if (SerializationUtil.ADD_ALL_AT_SIGNATURE.equals(methodSignature)) { logicalAddAllAtInvoke(this.serializer.methodToID(methodSignature), methodSignature, ((Integer) params[0]).intValue(), (Collection) params[1], tco); } else { adjustForJava1ParametersIfNecessary(methodSignature, params); tco.logicalInvoke(this.serializer.methodToID(methodSignature), methodSignature, params); } } } catch (final Throwable t) { Util.printLogAndRethrowError(t, logger); } } }
@Override public void wait(final LockID lock, final Object waitObject) throws InterruptedException, AbortedOperationException { if (clusteredLockingEnabled(lock) && (lock instanceof DsoLockID)) { if (isCurrentTransactionAtomic()) { throw new UnsupportedOperationException( "Wait is not supported under an atomic transaction"); } try { this.txManager.commit(lock, LockLevel.WRITE, false, null); } catch (final UnlockedSharedObjectException e) { throw new IllegalMonitorStateException(); } try { this.lockManager.wait(lock, waitObject); } finally { // XXX this is questionable this.txManager.begin(lock, LockLevel.WRITE, false); } } else { waitObject.wait(); } }
@Override public Notify notifyAll(final LockID lock, final Object waitObject) throws AbortedOperationException { if (clusteredLockingEnabled(lock) && (lock instanceof DsoLockID)) { this.txManager.notify(this.lockManager.notifyAll(lock, waitObject)); } else { waitObject.notifyAll(); } return NotifyImpl.NULL; }
public void init() throws ConfigurationSetupException { StandardConfigurationSetupManagerFactory factory = new StandardConfigurationSetupManagerFactory( (String[]) null, StandardConfigurationSetupManagerFactory.ConfigMode.EXPRESS_L1, new FatalIllegalConfigurationChangeHandler(), configSpec, securityManager); L1ConfigurationSetupManager config = factory.getL1TVSConfigurationSetupManager(securityInfo); config.setupLogging(); PreparedComponentsFromL2Connection l2Connection; try { l2Connection = validateMakeL2Connection(config, securityManager); } catch (Exception e) { throw new ConfigurationSetupException(e.getLocalizedMessage(), e); } DSOClientConfigHelper configHelperLocal = new StandardDSOClientConfigHelperImpl(config); this.configHelper = configHelperLocal; manager.set(configHelper, l2Connection); try { startToolkitConfigurator(); } catch (Exception e) { throw new ConfigurationSetupException(e.getLocalizedMessage(), e); } manager.init(); }
@Override public void initForTests(CountDownLatch latch) { init(true, latch); }
@Override public void checkWriteAccess(final Object context) { // XXX: make sure that "context" is the ALWAYS the right object to check here, and then rename it if (isManaged(context)) { try { this.txManager.checkWriteAccess(context); } catch (final Throwable t) { Util.printLogAndRethrowError(t, logger); } } }
public PlatformService getPlatformService() { return manager.getPlatformService(); }
private static DSOContextImpl createContext(ManagerImpl manager, String configSpec, TCSecurityManager securityManager, SecurityInfo securityInfo) { return new DSOContextImpl(manager.getClassProvider(), manager, configSpec, securityManager, securityInfo); }
@Override public void lockIDWait(final LockID lock, final long timeout) throws InterruptedException, AbortedOperationException { if (isCurrentTransactionAtomic()) { throw new UnsupportedOperationException( "Wait is not supported under an atomic transaction"); } try { this.txManager.commit(lock, LockLevel.WRITE, false, null); } catch (final UnlockedSharedObjectException e) { throw new IllegalMonitorStateException(); } try { this.lockManager.wait(lock, null, timeout); } finally { // XXX this is questionable this.txManager.begin(lock, LockLevel.WRITE, false); } }
@Override public void logicalInvoke(final Object object, final String methodSignature, final Object[] params) { final Manageable m = (Manageable) object; if (m.__tc_managed() != null) { final TCObject tco = lookupExistingOrNull(object); try { if (tco != null) { if (SerializationUtil.ADD_ALL_SIGNATURE.equals(methodSignature)) { logicalAddAllInvoke(this.serializer.methodToID(methodSignature), methodSignature, (Collection) params[0], tco); } else if (SerializationUtil.ADD_ALL_AT_SIGNATURE.equals(methodSignature)) { logicalAddAllAtInvoke(this.serializer.methodToID(methodSignature), methodSignature, ((Integer) params[0]).intValue(), (Collection) params[1], tco); } else { adjustForJava1ParametersIfNecessary(methodSignature, params); tco.logicalInvoke(this.serializer.methodToID(methodSignature), methodSignature, params); } } } catch (final Throwable t) { Util.printLogAndRethrowError(t, logger); } } }
@Override public void wait(final LockID lock, final Object waitObject, final long timeout) throws InterruptedException, AbortedOperationException { if (clusteredLockingEnabled(lock) && (lock instanceof DsoLockID)) { if (isCurrentTransactionAtomic()) { throw new UnsupportedOperationException( "Wait is not supported under an atomic transaction"); } try { this.txManager.commit(lock, LockLevel.WRITE, false, null); } catch (final UnlockedSharedObjectException e) { throw new IllegalMonitorStateException(); } try { this.lockManager.wait(lock, waitObject, timeout); } finally { // XXX this is questionable this.txManager.begin(lock, LockLevel.WRITE, false); } } else { waitObject.wait(timeout); } }
@Override public Notify notify(final LockID lock, final Object waitObject) throws AbortedOperationException { if (clusteredLockingEnabled(lock) && (lock instanceof DsoLockID)) { this.txManager.notify(this.lockManager.notify(lock, waitObject)); } else { waitObject.notify(); } return NotifyImpl.NULL; }
public void init() throws ConfigurationSetupException { StandardConfigurationSetupManagerFactory factory = new StandardConfigurationSetupManagerFactory( (String[]) null, StandardConfigurationSetupManagerFactory.ConfigMode.EXPRESS_L1, new FatalIllegalConfigurationChangeHandler(), configSpec, securityManager); L1ConfigurationSetupManager config = factory.getL1TVSConfigurationSetupManager(securityInfo); config.setupLogging(); PreparedComponentsFromL2Connection l2Connection; try { l2Connection = validateMakeL2Connection(config, securityManager); } catch (Exception e) { throw new ConfigurationSetupException(e.getLocalizedMessage(), e); } DSOClientConfigHelper configHelperLocal = new StandardDSOClientConfigHelperImpl(config); this.configHelper = configHelperLocal; manager.set(configHelper, l2Connection); try { startToolkitConfigurator(); } catch (Exception e) { throw new ConfigurationSetupException(e.getLocalizedMessage(), e); } manager.init(); }
@Override public void init() { init(false); }
@Override public void checkWriteAccess(final Object context) { // XXX: make sure that "context" is the ALWAYS the right object to check here, and then rename it if (isManaged(context)) { try { this.txManager.checkWriteAccess(context); } catch (final Throwable t) { Util.printLogAndRethrowError(t, logger); } } }
public PlatformService getPlatformService() { return manager.getPlatformService(); }
private static DSOContextImpl createContext(ManagerImpl manager, String configSpec, TCSecurityManager securityManager, SecurityInfo securityInfo) { return new DSOContextImpl(manager.getClassProvider(), manager, configSpec, securityManager, securityInfo); }