Search in sources :

Example 1 with BaseCache

use of com.sun.appserv.util.cache.BaseCache in project Payara by payara.

the class JavaEETransactionManagerSimplified method initProperties.

private void initProperties() {
    // FIXME: this maxEntry should be a config
    int maxEntries = 8192;
    // FIXME: this loadFactor should be a config
    float loadFactor = 0.75f;
    // for now, let's get it from system prop
    try {
        String mEnlistDelists = System.getProperty("ALLOW_MULTIPLE_ENLISTS_DELISTS");
        if ("true".equalsIgnoreCase(mEnlistDelists)) {
            multipleEnlistDelists = true;
            if (_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, "TM: multiple enlists, delists are enabled");
            }
        }
        String maxEntriesValue = System.getProperty("JTA_RESOURCE_TABLE_MAX_ENTRIES");
        if (maxEntriesValue != null) {
            int temp = Integer.parseInt(maxEntriesValue);
            if (temp > 0) {
                maxEntries = temp;
            }
        }
        String loadFactorValue = System.getProperty("JTA_RESOURCE_TABLE_DEFAULT_LOAD_FACTOR");
        if (loadFactorValue != null) {
            float f = Float.parseFloat(loadFactorValue);
            if (f > 0) {
                loadFactor = f;
            }
        }
    } catch (Exception ex) {
    // ignore
    }
    resourceTable = new BaseCache();
    ((BaseCache) resourceTable).init(maxEntries, loadFactor, null);
    if (habitat != null) {
        TransactionService txnService = habitat.getService(TransactionService.class, ServerEnvironment.DEFAULT_INSTANCE_NAME);
        // running on the server side ?
        if (txnService != null) {
            transactionTimeout = Integer.parseInt(txnService.getTimeoutInSeconds());
            // the delegates will do the rest if they support it
            String v = txnService.getPropertyValue("purge-cancelled-transactions-after");
            if (v != null && v.length() > 0) {
                purgeCancelledTtransactions = Integer.parseInt(v);
            }
            TransactionServiceConfigListener listener = habitat.getService(TransactionServiceConfigListener.class);
            listener.setTM(this);
        }
        ModuleMonitoringLevels levels = habitat.getService(ModuleMonitoringLevels.class);
        // running on the server side ?
        if (levels != null) {
            String level = levels.getTransactionService();
            if (!("OFF".equals(level))) {
                monitoringEnabled = true;
            }
        }
    }
    // ENF OF BUG 4665539
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "TM: Tx Timeout = " + transactionTimeout);
    }
    // START IASRI 4705808 TTT004 -- monitor resource table stats
    try {
        // XXX TODO:
        if (Boolean.getBoolean("MONITOR_JTA_RESOURCE_TABLE_STATISTICS")) {
            registerStatisticMonitorTask();
        }
        StatsProviderManager.register(// element in domain.xml <monitoring-service>/<monitoring-level>
        "transaction-service", // server.transaction-service node in asadmin get
        PluginPoint.SERVER, // server.transaction-service node in asadmin get
        "transaction-service", new TransactionServiceStatsProvider(this, _logger));
    } catch (Exception ex) {
    // ignore
    }
    monitor = new TransactionServiceProbeProvider();
}
Also used : TransactionService(com.sun.enterprise.transaction.config.TransactionService) ModuleMonitoringLevels(com.sun.enterprise.config.serverbeans.ModuleMonitoringLevels) BaseCache(com.sun.appserv.util.cache.BaseCache) PluginPoint(org.glassfish.external.probe.provider.PluginPoint) RemoteException(java.rmi.RemoteException) XAException(javax.transaction.xa.XAException) InvocationException(org.glassfish.api.invocation.InvocationException) WorkException(javax.resource.spi.work.WorkException) TransactionServiceStatsProvider(com.sun.enterprise.transaction.monitoring.TransactionServiceStatsProvider) TransactionServiceProbeProvider(com.sun.enterprise.transaction.monitoring.TransactionServiceProbeProvider)

Example 2 with BaseCache

use of com.sun.appserv.util.cache.BaseCache in project Payara by payara.

the class ActiveTxCache method registerMonitorableComponents.

@Override
protected void registerMonitorableComponents() {
    super.registerMonitorableComponents();
    if (readyStore != null) {
        int confMaxCacheSize = cacheProp.maxCacheSize;
        if (confMaxCacheSize <= 0) {
            confMaxCacheSize = Integer.MAX_VALUE;
        }
        this.cacheStatsProvider = new EntityCacheStatsProvider((BaseCache) readyStore, confMaxCacheSize);
        // registryMediator.registerProvider(cacheStatsProvider);
        cacheProbeListener = new EjbCacheStatsProvider(cacheStatsProvider, getContainerId(), containerInfo.appName, containerInfo.modName, containerInfo.ejbName);
        cacheProbeListener.register();
    }
    poolProbeListener = new EjbPoolStatsProvider(entityCtxPool, getContainerId(), containerInfo.appName, containerInfo.modName, containerInfo.ejbName);
    poolProbeListener.register();
    _logger.log(Level.FINE, "[Entity Container] registered monitorable");
}
Also used : EjbPoolStatsProvider(com.sun.ejb.monitoring.stats.EjbPoolStatsProvider) EjbCacheStatsProvider(com.sun.ejb.monitoring.stats.EjbCacheStatsProvider) BaseCache(com.sun.appserv.util.cache.BaseCache)

Example 3 with BaseCache

use of com.sun.appserv.util.cache.BaseCache in project Payara by payara.

the class ActiveTxCache method createReadyStore.

protected void createReadyStore(int cacheSize, int numberOfVictimsToSelect, float loadFactor, long idleTimeout) throws Exception {
    idleTimeout = (idleTimeout <= 0) ? -1 : idleTimeout;
    if (cacheSize <= 0 && idleTimeout <= 0) {
        readyStore = new BaseCache();
        cacheSize = DEFAULT_CACHE_SIZE;
        readyStore.init(cacheSize, loadFactor, null);
    } else {
        cacheSize = (cacheSize <= 0) ? DEFAULT_CACHE_SIZE : cacheSize;
        LruCache lru = new LruCache(DEFAULT_CACHE_SIZE);
        if (numberOfVictimsToSelect >= 0) {
            loadFactor = (float) (1.0 - (1.0 * numberOfVictimsToSelect / cacheSize));
        }
        lru.init(cacheSize, idleTimeout, loadFactor, null);
        readyStore = lru;
        readyStore.addCacheListener(this);
    }
    if (idleTimeout > 0) {
        idleBeansPassivator = setupIdleBeansPassivator(readyStore);
    }
}
Also used : LruCache(com.sun.appserv.util.cache.LruCache) BaseCache(com.sun.appserv.util.cache.BaseCache)

Aggregations

BaseCache (com.sun.appserv.util.cache.BaseCache)3 LruCache (com.sun.appserv.util.cache.LruCache)1 EjbCacheStatsProvider (com.sun.ejb.monitoring.stats.EjbCacheStatsProvider)1 EjbPoolStatsProvider (com.sun.ejb.monitoring.stats.EjbPoolStatsProvider)1 ModuleMonitoringLevels (com.sun.enterprise.config.serverbeans.ModuleMonitoringLevels)1 TransactionService (com.sun.enterprise.transaction.config.TransactionService)1 TransactionServiceProbeProvider (com.sun.enterprise.transaction.monitoring.TransactionServiceProbeProvider)1 TransactionServiceStatsProvider (com.sun.enterprise.transaction.monitoring.TransactionServiceStatsProvider)1 RemoteException (java.rmi.RemoteException)1 WorkException (javax.resource.spi.work.WorkException)1 XAException (javax.transaction.xa.XAException)1 InvocationException (org.glassfish.api.invocation.InvocationException)1 PluginPoint (org.glassfish.external.probe.provider.PluginPoint)1