/** * Creates an {@link EJBInvocationHandler} for the passed <code>locator</code> and associates this * invocation handler with the passed <code>ejbClientContextIdentifier</code> * * @param ejbClientContextIdentifier (Optional) EJB client context identifier. Can be null. * @param locator The {@link EJBLocator} cannot be null. */ EJBInvocationHandler( final EJBClientContextIdentifier ejbClientContextIdentifier, final EJBLocator<T> locator) { if (locator == null) { throw Logs.MAIN.paramCannotBeNull("EJB locator"); } this.ejbClientContextIdentifier = ejbClientContextIdentifier; this.locator = locator; async = false; if (locator instanceof StatefulEJBLocator) { // set the weak affinity to the node on which the session was created final String sessionOwnerNode = ((StatefulEJBLocator) locator).getSessionOwnerNode(); if (sessionOwnerNode != null) { this.setWeakAffinity(new NodeAffinity(sessionOwnerNode)); } } // scan for annotations on the view class, if necessary final String annotationScanEnabledSysPropVal = SecurityActions.getSystemProperty(ENABLE_ANNOTATION_SCANNING_SYSTEM_PROPERTY); if (annotationScanEnabledSysPropVal != null && Boolean.valueOf(annotationScanEnabledSysPropVal.trim())) { scanAnnotationsOnViewClass(); } else { // let's for the sake of potential performance optimization, add an attachment which lets the // EJBReceiver(s) and any other decision making // code to decide whether it can entirely skip any logic related to "hints" (like // @org.jboss.ejb.client.annotation.CompressionHint) putAttachment(AttachmentKeys.HINTS_DISABLED, true); } }