Index: core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableServiceListener.java =================================================================== --- core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableServiceListener.java (revision 35415) +++ core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableServiceListener.java (working copy) @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -62,9 +62,9 @@ @Override protected GrizzlyEmbeddedHttp createEmbeddedHttp(boolean isSecured) { if (isSecured) { - return new MonitorableEmbeddedHttps(monitoring, this, monitoringId); + return new MonitorableEmbeddedHttps(monitoring, monitoringId); } else { - return new MonitorableEmbeddedHttp(monitoring, this, monitoringId); + return new MonitorableEmbeddedHttp(monitoring, monitoringId); } } } Index: core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttps.java =================================================================== --- core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttps.java (revision 35415) +++ core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttps.java (working copy) @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -38,7 +38,6 @@ import com.sun.grizzly.TCPSelectorHandler; import com.sun.grizzly.config.GrizzlyEmbeddedHttps; -import com.sun.grizzly.config.GrizzlyServiceListener; import com.sun.grizzly.http.FileCacheFactory; import com.sun.grizzly.http.KeepAliveStats; import com.sun.grizzly.http.SelectorThreadKeyHandler; @@ -57,8 +56,8 @@ public MonitorableEmbeddedHttps( GrizzlyMonitoring monitoring, - GrizzlyServiceListener grizzlyServiceListener, String monitoringId) { - super(grizzlyServiceListener); + String monitoringId) { + this.monitoring = monitoring; this.monitoringId = monitoringId; Index: core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttp.java =================================================================== --- core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttp.java (revision 35415) +++ core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttp.java (working copy) @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -57,9 +57,7 @@ public MonitorableEmbeddedHttp( GrizzlyMonitoring monitoring, - GrizzlyServiceListener grizzlyServiceListener, String monitoringId) { - super(grizzlyServiceListener); this.monitoring = monitoring; this.monitoringId = monitoringId; Index: core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableThreadPool.java =================================================================== --- core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableThreadPool.java (revision 35415) +++ core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableThreadPool.java (working copy) @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 2007-2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -38,10 +38,12 @@ package com.sun.enterprise.v3.services.impl.monitor; -import com.sun.enterprise.v3.services.impl.monitor.probes.ThreadPoolProbeProvider; import com.sun.enterprise.v3.services.impl.monitor.stats.StatsProvider; import com.sun.grizzly.http.StatsThreadPool; -import com.sun.grizzly.util.AbstractThreadPool.Worker; +import com.sun.grizzly.util.ThreadPoolConfig; +import com.sun.grizzly.util.ThreadPoolMonitoringProbe; + +import java.util.Queue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; @@ -53,19 +55,29 @@ */ public class MonitorableThreadPool extends StatsThreadPool { - // The GrizzlyMonitoring objects, which encapsulates Grizzly probe emitters - private final GrizzlyMonitoring monitoring; - private final String monitoringId; + // ------------------------------------------------------------ Constructors + + public MonitorableThreadPool( GrizzlyMonitoring monitoring, String monitoringId, String threadPoolName, int corePoolSize, int maximumPoolSize, int maxTasksCount, long keepAliveTime, TimeUnit unit) { - super(threadPoolName, corePoolSize, maximumPoolSize, maxTasksCount, - keepAliveTime, unit); - this.monitoring = monitoring; - this.monitoringId = monitoringId; + super(new GrizzlyIntegrationThreadPoolConfig( + monitoringId, + monitoring, + threadPoolName, + corePoolSize, + maximumPoolSize, + null, + maxTasksCount, + keepAliveTime, + unit, + null, + Thread.NORM_PRIORITY)); + + if (monitoring != null) { StatsProvider statsProvider = monitoring.getThreadPoolStatsProvider(monitoringId); @@ -79,129 +91,234 @@ statsProvider.setStatsObject(this); } - } + ThreadPoolConfig config = getConfiguration(); - setThreadFactory(new ProbeWorkerThreadFactory()); + // force related events to be fired though the values aren't + // changing. + config.setCorePoolSize(config.getCorePoolSize()); + config.setMaxPoolSize(config.getMaxPoolSize()); + config.setQueueLimit(config.getQueueLimit()); - final ThreadPoolProbeProvider threadPoolProbeProvider = - monitoring.getThreadPoolProbeProvider(); - - threadPoolProbeProvider.setCoreThreadsEvent( - monitoringId, threadPoolName, super.corePoolSize); - threadPoolProbeProvider.setMaxThreadsEvent( - monitoringId, threadPoolName, super.maxPoolSize); + } - monitoring.getConnectionQueueProbeProvider().setMaxTaskQueueSizeEvent( - monitoringId, getMaxQueuedTasksCount()); } - @Override - public void setCorePoolSize(int corePoolSize) { - synchronized (statelock) { - super.setCorePoolSize(corePoolSize); - if (monitoring == null) return; + // ---------------------------------------------------------- Nested Classes - monitoring.getThreadPoolProbeProvider().setCoreThreadsEvent( - monitoringId, getName(), corePoolSize); + + /** + * Custom {@link ThreadPoolConfig} to link V3 probe monitors into the + * Grizzly runtime. + */ + private static class GrizzlyIntegrationThreadPoolConfig extends ThreadPoolConfig { + + private final String monitoringId; + private final GrizzlyMonitoring monitoring; + + + // -------------------------------------------------------- Constructors + + + public GrizzlyIntegrationThreadPoolConfig(String monitoringId, + GrizzlyMonitoring monitoring, + String poolName, + int corePoolSize, + int maxPoolSize, + Queue queue, + int queueLimit, + long keepAliveTime, + TimeUnit timeUnit, + ThreadFactory threadFactory, + int priority) { + + super(poolName, + corePoolSize, + maxPoolSize, + queue, + queueLimit, + keepAliveTime, + timeUnit, + threadFactory, + priority, + null); + super.setMonitoringProbe(new GrizzlyIntegrationThreadPoolMonitoringProbe()); + this.monitoringId = monitoringId; + this.monitoring = monitoring; + } - } - @Override - public void setMaximumPoolSize(int maxPoolSize) { - synchronized (statelock) { - super.setMaximumPoolSize(maxPoolSize); - - if (monitoring == null) return; - monitoring.getThreadPoolProbeProvider().setMaxThreadsEvent( - monitoringId, getName(), maxPoolSize); + // --------------------------------------- Methods from ThreadPoolConfig + + + /** + * @see ThreadPoolConfig#setCorePoolSize(int) + */ + @Override public ThreadPoolConfig setCorePoolSize(int corePoolSize) { + + if (monitoring != null) { + monitoring.getThreadPoolProbeProvider().setCoreThreadsEvent( + monitoringId, getPoolName(), corePoolSize); + } + return super.setCorePoolSize(corePoolSize); + } - } - @Override - protected void setPoolSizes(int corePoolSize, int maxPoolSize) { - synchronized (statelock) { - super.setPoolSizes(corePoolSize, maxPoolSize); - if (monitoring == null) return; + /** + * @see ThreadPoolConfig#setMaxPoolSize(int) + */ + @Override public ThreadPoolConfig setMaxPoolSize(int maxPoolSize) { - final ThreadPoolProbeProvider threadPoolProbeProvider = - monitoring.getThreadPoolProbeProvider(); + if (monitoring != null) { + monitoring.getThreadPoolProbeProvider().setMaxThreadsEvent( + monitoringId, getPoolName(), maxPoolSize); + } + return super.setMaxPoolSize(maxPoolSize); - threadPoolProbeProvider.setCoreThreadsEvent( - monitoringId, getName(), corePoolSize); - threadPoolProbeProvider.setMaxThreadsEvent( - monitoringId, getName(), maxPoolSize); } - } - @Override - protected void beforeExecute(Thread thread, Runnable runnable) { - super.beforeExecute(thread, runnable); - monitoring.getThreadPoolProbeProvider().threadDispatchedFromPoolEvent( - monitoringId, getName(), thread.getName()); - } + /** + * @see ThreadPoolConfig#setQueueLimit(int) + */ + @Override public ThreadPoolConfig setQueueLimit(int limit) { - @Override - protected void afterExecute(Runnable r, Throwable t) { - monitoring.getThreadPoolProbeProvider().threadReturnedToPoolEvent( - monitoringId, getName(), Thread.currentThread().getName()); - super.afterExecute(r, t); - } + if (monitoring != null) { + monitoring.getConnectionQueueProbeProvider().setMaxTaskQueueSizeEvent( + monitoringId, limit); + } + return super.setQueueLimit(limit); - @Override - protected void onWorkerStarted(Worker worker) { - super.onWorkerStarted(worker); - monitoring.getThreadPoolProbeProvider().threadAllocatedEvent( - monitoringId, getName(), Thread.currentThread().getName()); - } + } - @Override - protected void onWorkerExit(Worker worker) { - monitoring.getThreadPoolProbeProvider().threadReleasedEvent( - monitoringId, getName(), Thread.currentThread().getName()); - super.onWorkerExit(worker); - } - @Override - protected void onMaxNumberOfThreadsReached() { - monitoring.getThreadPoolProbeProvider().maxNumberOfThreadsReachedEvent( - monitoringId, getName(), getMaximumPoolSize()); - super.onMaxNumberOfThreadsReached(); - } + // ------------------------------------------------------- Inner Classes - @Override - protected void onTaskQueued(Runnable task) { - monitoring.getConnectionQueueProbeProvider().onTaskQueuedEvent( - monitoringId, String.valueOf(task.hashCode())); - super.onTaskQueued(task); - } + /** + * An implementation of {@link ThreadPoolMonitoringProbe} which delegates + * probe calls from the {@link com.sun.grizzly.util.GrizzlyExecutorService} + * to the provided {@link GrizzlyMonitoring} instance. + */ + private class GrizzlyIntegrationThreadPoolMonitoringProbe + implements ThreadPoolMonitoringProbe { - @Override - protected void onTaskDequeued(Runnable task) { - monitoring.getConnectionQueueProbeProvider().onTaskDequeuedEvent( - monitoringId, String.valueOf(task.hashCode())); - super.onTaskDequeued(task); - } - @Override - protected void onTaskQueueOverflow() { - monitoring.getConnectionQueueProbeProvider().onTaskQueueOverflowEvent( - monitoringId); - super.onTaskQueueOverflow(); - } + // ------------------------------ Methods from ThreadPoolMonitoringProbe - public class ProbeWorkerThreadFactory implements ThreadFactory { - @Override - public Thread newThread(Runnable r) { - Thread thread = new MonitorableWorkerThread( - MonitorableThreadPool.this, r, name + - "-(" + nextThreadId() + ")", - initialByteBufferSize, monitoring); - return thread; - } - } + /** + * @see com.sun.grizzly.util.ThreadPoolMonitoringProbe#threadAllocatedEvent(String, Thread) + */ + @Override public void threadAllocatedEvent(String threadPoolName, + Thread thread) { + + if (monitoring != null) { + monitoring.getThreadPoolProbeProvider() + .threadAllocatedEvent(monitoringId, + threadPoolName, + thread.getName()); + } + + } + + + /** + * @see com.sun.grizzly.util.ThreadPoolMonitoringProbe#threadAllocatedEvent(String, Thread) + */ + @Override public void threadReleasedEvent(String threadPoolName, + Thread thread) { + + if (monitoring != null) { + monitoring.getThreadPoolProbeProvider() + .threadReleasedEvent(monitoringId, + threadPoolName, + thread.getName()); + } + + } + + + /** + * @see com.sun.grizzly.util.ThreadPoolMonitoringProbe#threadAllocatedEvent(String, Thread) + */ + @Override + public void maxNumberOfThreadsReachedEvent(String threadPoolName, + int maxNumberOfThreads) { + + if (monitoring != null) { + monitoring.getThreadPoolProbeProvider() + .maxNumberOfThreadsReachedEvent(monitoringId, + threadPoolName, + maxNumberOfThreads); + } + + } + + + /** + * @see com.sun.grizzly.util.ThreadPoolMonitoringProbe#threadAllocatedEvent(String, Thread) + */ + @Override public void onTaskQueuedEvent(Runnable runnable) { + + if (monitoring != null) { + monitoring.getConnectionQueueProbeProvider() + .onTaskQueuedEvent(monitoringId, + String.valueOf(runnable.hashCode())); + } + + } + + + /** + * @see com.sun.grizzly.util.ThreadPoolMonitoringProbe#threadAllocatedEvent(String, Thread) + */ + @Override public void onTaskDequeuedEvent(Runnable runnable) { + + if (monitoring != null) { + monitoring.getConnectionQueueProbeProvider() + .onTaskDequeuedEvent(monitoringId, + String.valueOf(runnable.hashCode())); + monitoring.getThreadPoolProbeProvider() + .threadDispatchedFromPoolEvent(monitoringId, + getPoolName(), + Thread.currentThread().getName()); + } + + } + + + /** + * @see com.sun.grizzly.util.ThreadPoolMonitoringProbe#threadAllocatedEvent(String, Thread) + */ + @Override + public void onTaskQueueOverflowEvent(String threadPoolName) { + + if (monitoring != null) { + monitoring.getConnectionQueueProbeProvider() + .onTaskQueueOverflowEvent(monitoringId); + } + + } + + + /** + * @see ThreadPoolMonitoringProbe#onTaskCompletedEvent(Runnable) + */ + @Override public void onTaskCompletedEvent(Runnable runnable) { + + if (monitoring != null) { + monitoring.getThreadPoolProbeProvider() + .threadReturnedToPoolEvent(monitoringId, + getPoolName(), + Thread.currentThread().getName()); + } + + } + + } // END GrizzlyIntegrationThreadPoolMonitoringProbe + + } // END GrizzlyIntegrationThreadPoolConfig + } Index: pom.xml =================================================================== --- pom.xml (revision 35415) +++ pom.xml (working copy) @@ -3,7 +3,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * -* Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved. +* Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -104,8 +104,8 @@ 0.2 4.0.2.3 1.1 - 1.9.18-k - 1.9.18-k + 1.9.19-beta1 + 1.9.19-beta1 2.1 2.1 1.0 Index: packager/metro/pom.xml =================================================================== --- packager/metro/pom.xml (revision 35415) +++ packager/metro/pom.xml (working copy) @@ -3,7 +3,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * -* Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved. +* Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -112,6 +112,22 @@ com.sun.grizzly grizzly-http-servlet + + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-server + + Index: packager/glassfish-nucleus/pom.xml =================================================================== --- packager/glassfish-nucleus/pom.xml (revision 35415) +++ packager/glassfish-nucleus/pom.xml (working copy) @@ -3,7 +3,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * -* Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved. +* Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -104,6 +104,20 @@ stax stax + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-server + Index: packager/pkg_conf.py.template =================================================================== --- packager/pkg_conf.py.template (revision 35415) +++ packager/pkg_conf.py.template (working copy) @@ -25,7 +25,7 @@ javadb_version="10.5.3.0,0-0" corba_version="3.0.0,0-41" jsf_version="2.0.2,0-10" -grizzly_version="1.9.18,0-9" +grizzly_version="1.9.19,0-0" metro_version="2.0,0-29" javahelp_version="2.0.2,0-0" Index: packager/glassfish-web/pom.xml =================================================================== --- packager/glassfish-web/pom.xml (revision 35415) +++ packager/glassfish-web/pom.xml (working copy) @@ -3,7 +3,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * -* Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved. +* Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -76,7 +76,8 @@ webtier-all ${project.version} pom - + --> + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-server + + org.glassfish Index: packager/glassfish-osgi-http/pom.xml =================================================================== --- packager/glassfish-osgi-http/pom.xml (revision 35415) +++ packager/glassfish-osgi-http/pom.xml (working copy) @@ -3,7 +3,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * -* Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved. +* Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -86,7 +86,28 @@ glassfish-web ${project.version} zip - + + + stax + stax + + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-server + + + + Index: packager/glassfish-cmp/pom.xml =================================================================== --- packager/glassfish-cmp/pom.xml (revision 35415) +++ packager/glassfish-cmp/pom.xml (working copy) @@ -3,7 +3,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * -* Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved. +* Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -88,6 +88,22 @@ glassfish-ejb ${project.version} zip + + + + com.sun.jersey + jersey-client + + + com.sun.jersey + jersey-server + + Index: admin/config-api/src/main/java/org/glassfish/config/support/GrizzlyConfigSchemaMigrator.java =================================================================== --- admin/config-api/src/main/java/org/glassfish/config/support/GrizzlyConfigSchemaMigrator.java (revision 35415) +++ admin/config-api/src/main/java/org/glassfish/config/support/GrizzlyConfigSchemaMigrator.java (working copy) @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009-2010 Sun Microsystems, Inc. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -408,7 +408,7 @@ final RequestProcessing request = httpService.getRequestProcessing(); ConfigSupport.apply(new SingleConfigCode() { @Override - public Object run(final ThreadPool pool) { + public Object run(final ThreadPool pool) throws PropertyVetoException, TransactionFailure { pool.setMaxThreadPoolSize(request.getThreadCount()); pool.setMinThreadPoolSize(request.getInitialThreadCount()); if (pool.getMinThreadPoolSize() == null || Integer.parseInt(pool.getMinThreadPoolSize()) < 2) {