Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2012, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
 package org.jboss.as.connector.deployers.ra.processors;
 
 import java.util.Map;
 import java.util.Set;
 
Setup processor that adds sets operations for the cached connection manager. These operations are run around incoming requests.

Author(s):
Stuart Douglas
 
 
     private static final ServiceName SERVICE_NAME = ServiceName.of("jca""cachedConnectionManagerSetupProcessor");
 
 
     @Override
     public void deploy(final DeploymentPhaseContext phaseContextthrows DeploymentUnitProcessingException {
         final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
         final ServiceName serviceName = deploymentUnit.getServiceName().append();
         final CachedConnectionManagerSetupAction action = new CachedConnectionManagerSetupAction(serviceName);
 
         phaseContext.getServiceTarget().addService(serviceNameaction)
                 .addDependency(.CachedConnectionManager.classaction.cachedConnectionManager)
                 .install();
         deploymentUnit.addToAttachmentList(.action);
         deploymentUnit.addToAttachmentList(.action);
 
     }
 
     @Override
     public void undeploy(final DeploymentUnit context) {
 
     }
 
     private static class CachedConnectionManagerSetupAction implements SetupActionService<Void> {
 
 
 
         private final ServiceName serviceName;
 
         private static final Set<?> unsharable = new HashSet<Object>();
 
         private CachedConnectionManagerSetupAction(final ServiceName serviceName) {
             this. = serviceName;
         }
 
 
         @Override
         public void setup(final Map<StringObjectproperties) {
             try {
                 final CachedConnectionManager connectionManager = .getOptionalValue();
                 if (connectionManager != null) {
                     connectionManager.pushMetaAwareObject(this);
                 }
             } catch (ResourceException e) {
                 throw new RuntimeException(e);
             }
        }
        @Override
        public void teardown(final Map<StringObjectproperties) {
            try {
                final CachedConnectionManager connectionManager = .getOptionalValue();
                if (connectionManager != null) {
                    connectionManager.popMetaAwareObject();
                }
            } catch (ResourceException e) {
                throw new RuntimeException(e);
            }
        }
        @Override
        public int priority() {
            return 0;
        }
        @Override
        public Set<ServiceNamedependencies() {
            return Collections.singleton();
        }
        @Override
        public void start(final StartContext contextthrows StartException {
        }
        @Override
        public void stop(final StopContext context) {
        }
        @Override
        public Void getValue() throws IllegalStateExceptionIllegalArgumentException {
            return null;
        }
    }
New to GrepCode? Check out our FAQ X