/** * Closes the lookup finder if the {@link #ACTUAL_CLOSE_SYSTEM_PROPERTY} is set to "true". IF it * is not set, will default to "true". */ public static void close() { if (System.getProperty(ACTUAL_CLOSE_SYSTEM_PROPERTY, "true").equals("true")) { forceClose(); } }
/** * @see com.gigaspaces.internal.naming.INamingService#notify(net.jini.core.lookup.ServiceTemplate, * net.jini.lookup.ServiceItemFilter, net.jini.lookup.ServiceDiscoveryListener) **/ public LookupCache notify(ServiceTemplate tmpl, ServiceItemFilter filter, ServiceDiscoveryListener listener) throws RemoteException { // sort before lookup so we will have a predictable order of templates LookupFinder.sortLookupAttributes(tmpl.attributeSetTemplates); return _serviceDiscoveryManager.createLookupCache(tmpl, filter, listener); }
final String serviceName = request.getServiceName(); final Class serviceClass = request.getServiceClass(); final ServiceID serviceID = getServiceIDFromRequest(request); final Entry[] serviceAttributes = appendNameIfNeeded(request.getServiceAttributes(), serviceName); sortLookupAttributes(serviceAttributes); if (serviceName == null && serviceClass == null && serviceAttributes == null) throw new IllegalArgumentException("All parameters can not be null."); try { sdm = SharedDiscoveryManagement.getBackwardsServiceDiscoveryManager(lookupGroups, lookupLocators, null); result = find(template, sdm, timeout, request); } catch (Exception ex) { exception = ex; _logger.config(generateReport(result, serviceName, serviceID, serviceClass, serviceAttributes, lookupLocators, lookupGroups, timeout, sdm)); String report = generateReport(null, serviceName, serviceID, serviceClass, serviceAttributes, lookupLocators, lookupGroups, timeout, sdm); if (_logger.isLoggable(Level.CONFIG))
public TransactionManager getDistributedTransactionManager() throws JMSException { if (dtm == null) { try { LookupRequest request = LookupRequest.TransactionManager() .setLocators(getSpaceURL().getProperty(SpaceURL.LOCATORS)) .setGroups(getSpaceURL().getProperty(SpaceURL.GROUPS)) .setTimeout(10 * 1000); dtm = (TransactionManager) LookupFinder.find(request); if (_logger.isLoggable(Level.FINE)) _logger.fine("Created Distributed Transaction Manager: " + dtm.toString()); } catch (FinderException fe) { if (_logger.isLoggable(Level.SEVERE)) _logger.log(Level.SEVERE, "Failed to create Exception Distributed Transaction Manager.", fe); JMSException e = new JMSException("FinderException: " + fe.toString()); e.setLinkedException(fe); throw e; } } return dtm; }
@Override public synchronized void close() { if (closed) return; closed = true; if (_dataEventsManager != null) _dataEventsManager.close(); if (_typeManager != null) _typeManager.close(); if (_proxyRouter != null) _proxyRouter.close(); // close the lookup finder (cleans it). Will not be closed when running within the GSC since we want to share it LookupFinder.close(); }
public LookupDistributedTransactionManagerProvider(LookupTransactionManagerConfiguration config) throws TransactionException { try { LookupRequest request = LookupRequest.TransactionManager() .setServiceName(config.getLookupTransactionName()) .setLocators(config.getLookupTransactionLocators()) .setGroups(config.getLookupTransactionGroups()) .setTimeout(config.getLookupTransactionTimeout()); _transactionManager = (TransactionManager) LookupFinder.find(request); } catch (FinderException e) { throw new TransactionException(e.getMessage(), e); } }
private static Object findJiniSpace(SpaceURL url, String spaceUuid, Properties customProperties, long timeout, LookupType lookupType, boolean postProcess) throws FinderException { // NOTE, the Service.class should be used here as there is a special cache aside in GigaRegistrar based on it LookupRequest request = new LookupRequest(Service.class) .setLocators(url.getHost()) .setGroups(url.getProperty(SpaceURL.GROUPS)) .setCustomProperties(customProperties) .setTimeout(timeout) .setLookupInterval(url.getLookupIntervalTimeout()) .setLookupType(lookupType) .setSpaceUuid(spaceUuid); if(spaceUuid == null) request= request.setServiceAttributes(url.getLookupAttributes()); boolean previousLazyAccessValue = DefaultProxyPivot.updateLazyAccess(!postProcess); try { Object result = LookupFinder.find(request); if (postProcess) ((SpaceProxyImpl) result).setFinderURL(url); return result; } finally { DefaultProxyPivot.updateLazyAccess(previousLazyAccessValue); } }
/** * @see com.gigaspaces.internal.naming.INamingService#lookup(net.jini.core.lookup.ServiceTemplate, * int, net.jini.lookup.ServiceItemFilter) **/ public ServiceItem[] lookup(ServiceTemplate srvTemplate, int maxMatches, ServiceItemFilter filter) { // sort before lookup so we will have a predictable order of templates LookupFinder.sortLookupAttributes(srvTemplate.attributeSetTemplates); ServiceItem[] serviceItems = _serviceDiscoveryManager.lookup(srvTemplate, maxMatches, filter); if (serviceItems.length == 0) { //check that there are any lookup services registered ServiceRegistrar[] registrars = _serviceDiscoveryManager.getDiscoveryManager().getRegistrars(); if (registrars.length == 0) { return null; //indicate that there are no lookup services registered } } return serviceItems; //can be zero length if lookup services are registered and no matches for template }