Search in sources :

Example 1 with TransactionServiceStatsProvider

use of com.sun.enterprise.transaction.monitoring.TransactionServiceStatsProvider 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".equals(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) InvocationException(org.glassfish.api.invocation.InvocationException) WorkException(javax.resource.spi.work.WorkException) RemoteException(java.rmi.RemoteException) XAException(javax.transaction.xa.XAException) TransactionServiceStatsProvider(com.sun.enterprise.transaction.monitoring.TransactionServiceStatsProvider) TransactionServiceProbeProvider(com.sun.enterprise.transaction.monitoring.TransactionServiceProbeProvider)

Aggregations

BaseCache (com.sun.appserv.util.cache.BaseCache)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