private Lock getLock(String key) { return this.oauthManager.getMuleContext() .getLockFactory() .createLock(String.format("OAuthTokenKeyLock-%s", key)); }
protected void doStart() { MuleContext context = getRegistry().lookupObject(MuleProperties.OBJECT_MULE_CONTEXT); lockFactory = context.getLockFactory(); if (counterObjectStore == null) { counterObjectStore = getRegistry().lookupObject(MuleProperties.DEFAULT_USER_OBJECT_STORE_NAME); if (counterObjectStore == null) { throw new IllegalArgumentException("Unable to acquire an object store."); } } }
/** * {@inheritDoc} This implementation uses a lock to guarantee that no refresh * token is consumed more than once * * @see org.mule.security.oauth.RefreshTokenManager#refreshToken(org.mule.security.oauth.OAuth2Adapter, * java.lang.String) */ @Override public void refreshToken(OAuth2Adapter adapter, String accessTokenId) throws Exception { if (StringUtils.isEmpty(accessTokenId)) { throw new IllegalArgumentException("Cannot refresh a blank accessTokenId"); } String id = String.format("%s:%s:%s", this.getClass().getCanonicalName(), adapter.getName(), accessTokenId); Lock lock = this.muleContext.getLockFactory().createLock(id); lock.lock(); try { if (!this.getRefreshedTokens().contains(id)) { adapter.refreshAccessToken(accessTokenId); this.getRefreshedTokens().store(id, true); } } finally { lock.unlock(); } }
Lock lock = muleContext.getLockFactory().createLock(sharedObjectStoreLockId); lock.lock(); try {
Lock lock = muleContext.getLockFactory().createLock(sharedObjectStoreLockId); lock.lock(); try {
MuleMessage muleMessage) throws ObjectStoreException { Lock lock = muleContext.getLockFactory().createLock(sharedObjectStoreLockId); lock.lock();
@Override protected void doInitialise() throws InitialisationException { this.lockFactory = getEndpoint().getMuleContext().getLockFactory(); boolean synchronousProcessing = false; if (getFlowConstruct() instanceof Flow) { synchronousProcessing = ((Flow)getFlowConstruct()).getProcessingStrategy() instanceof SynchronousProcessingStrategy; } this.poolOnPrimaryInstanceOnly = Boolean.valueOf(System.getProperty(MULE_TRANSPORT_FILE_SINGLEPOLLINSTANCE,"false")) || !synchronousProcessing; ObjectStoreManager objectStoreManager = getEndpoint().getMuleContext().getRegistry().get(MuleProperties.OBJECT_STORE_MANAGER); filesBeingProcessingObjectStore = objectStoreManager.getObjectStore(getEndpoint().getName(),false,1000,60000,20000); }
String flowName = flowConstruct.getName(); idrId = String.format("%s-%s-%s",appName,flowName,"idr"); lockFactory = muleContext.getLockFactory(); if (store == null)
MuleMessage muleMessage) throws ObjectStoreException { Lock lock = muleContext.getLockFactory().createLock(sharedObjectStoreLockId); lock.lock(); Object ret;
Lock lock = muleContext.getLockFactory().createLock(sharedObjectStoreLockId); lock.lock(); try {