[JBoss JIRA] (WFLY-804) Possibly missing metrics for datasources
by Brian Stansberry (JIRA)
[ https://issues.jboss.org/browse/WFLY-804?page=com.atlassian.jira.plugin.s... ]
Brian Stansberry resolved WFLY-804.
-----------------------------------
Resolution: Rejected
>From the discussion it looks like this isn't a bug.
> Possibly missing metrics for datasources
> ----------------------------------------
>
> Key: WFLY-804
> URL: https://issues.jboss.org/browse/WFLY-804
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Domain Management, JCA
> Reporter: Heiko Rupp
> Assignee: Heiko Rupp
> Labels: rhq
>
> The following metrics / operations are present in earlier versions of AS and may be missing in as7:
> operations
> -listFormattedSubPoolStatistics
> -listStatistics
> metrics / properties
> - poolJndiName
> - connectionCount
> - inUseConnectionCount
> - local-transaction
> - metadata (cmp ?)
> - type-mapping (cmp)
> - statistics-formatter
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
11 years, 9 months
[JBoss JIRA] (WFLY-840) jboss.as MBean subtree missing when profiling agent used
by Brian Stansberry (JIRA)
[ https://issues.jboss.org/browse/WFLY-840?page=com.atlassian.jira.plugin.s... ]
Brian Stansberry resolved WFLY-840.
-----------------------------------
Resolution: Done
I'm resolving this as a duplicate of WFLY-895, since per Juliana Loubock's comment, working around the logging issue results in the jboss.as domain mbeans appearing.
> jboss.as MBean subtree missing when profiling agent used
> --------------------------------------------------------
>
> Key: WFLY-840
> URL: https://issues.jboss.org/browse/WFLY-840
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: JMX
> Reporter: dpocock
> Labels: jconsole
>
> I've set up JBoss 7.1.0.Final as a fresh installation and started standalone
> I can successfully connect with regular jconsole or $JBOSS_HOME/bin/jconsole. In the MBeans tab, I can see various subtrees, including jboss.as
> Then I stop JBoss and add the jmxetric monitoring agent, as described here:
> http://danielpocock.com/monitoring-jboss-tomcat-and-application-servers-w...
> Now, with JBoss running with jmxetric, I connect to it with jconsole (either regular jconsole or $JBOSS_HOME/bin/jconsole) and I can see all the same subtrees, except one, jboss.as is missing. I can see jboss.modules, jboss.ws, jboss.msc, jboss.jta and core JVM subtrees
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
11 years, 9 months
[JBoss JIRA] (WFLY-3084) make statistics-enabled for pool and jdbc stats in DataSources model attribute
by Brian Stansberry (JIRA)
[ https://issues.jboss.org/browse/WFLY-3084?page=com.atlassian.jira.plugin.... ]
Brian Stansberry commented on WFLY-3084:
----------------------------------------
Looks like this is done:
taozi:wildfly bstansberry$ git log | grep -B 5 WFLY-3084
commit 79e498acfe673c526b897ffd0239caeae0695fab
Author: Kabir Khan <kkhan(a)redhat.com>
Date: Tue Apr 1 20:11:29 2014 +0100
WFLY-3084 Fix mixed domain tests
--
commit 13ee228691067c7cef2d21bc5a9d6c39c36a5861
Author: Kabir Khan <kkhan(a)redhat.com>
Date: Tue Apr 1 13:53:46 2014 +0100
[WFLY-3084] :enable and :disable transformers should work without statistics-enabled=true
--
commit dc9a57dc4983bc37b6b2100511d89338522150d7
Author: Kabir Khan <kkhan(a)redhat.com>
Date: Fri Mar 28 17:34:12 2014 +0000
WFLY-3084 Fix up datasources transformers tests
--
commit 5aaf5d6344335ccdda50548d17a0123dca437856
Author: Stefano Maestri <stefano.maestri(a)ironjacamar.org>
Date: Fri Mar 28 12:06:12 2014 +0100
WFLY-3084 make statistics-enabled for pool and jdbc stats in DataSources model attribute
> make statistics-enabled for pool and jdbc stats in DataSources model attribute
> ------------------------------------------------------------------------------
>
> Key: WFLY-3084
> URL: https://issues.jboss.org/browse/WFLY-3084
> Project: WildFly
> Issue Type: Task
> Security Level: Public(Everyone can see)
> Components: JCA
> Reporter: Stefano Maestri
> Assignee: Stefano Maestri
> Fix For: 9.0.0.Beta1
>
>
> Pulling up this statsistics-enabled attributes to specific Model attributes fro DataSource will make them marshallable and so will permit to keep statististics-enabled configuration set after server reload
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
11 years, 9 months
[JBoss JIRA] (WFLY-3684) JBAS012144: Could not connect to remote://localhost:9999. The connection timed out
by Perry Anderson (JIRA)
Perry Anderson created WFLY-3684:
------------------------------------
Summary: JBAS012144: Could not connect to remote://localhost:9999. The connection timed out
Key: WFLY-3684
URL: https://issues.jboss.org/browse/WFLY-3684
Project: WildFly
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Domain Management
Affects Versions: 8.1.0.Final
Environment: Ubuntu 12.04.4
Reporter: Perry Anderson
Assignee: Brian Stansberry
the mvn jboss-as:deploy operation times out complaining that it could not connect:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.662s
[INFO] Finished at: Tue Jul 29 01:26:12 UTC 2014
[INFO] Final Memory: 19M/174M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:deploy (default-cli) on project jboss-kitchensink-rf: Could not execute goal deploy on /home/jboss/workspace/jboss-kitchensink-rf/target/jboss-kitchensink-rf.war. Reason: I/O Error could not execute operation '{
[ERROR] "address" => [],
[ERROR] "operation" => "read-attribute",
[ERROR] "name" => "launch-type"
[ERROR] }': java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:9999. The connection timed out
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I tried the same project with EAP 6.0 and mvn command works fine. This is an issue narrowed down to 8.1.0.Final.
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
11 years, 9 months
[JBoss JIRA] (WFLY-3682) SFSB DistributedCache doesn't commit when get(...) and release/discard(...) use different threads
by Paul Ferraro (JIRA)
[ https://issues.jboss.org/browse/WFLY-3682?page=com.atlassian.jira.plugin.... ]
Paul Ferraro updated WFLY-3682:
-------------------------------
Git Pull Request: https://github.com/wildfly/wildfly/pull/6541, https://github.com/wildfly/wildfly/pull/6543 (was: https://github.com/wildfly/wildfly/pull/6541)
> SFSB DistributedCache doesn't commit when get(...) and release/discard(...) use different threads
> -------------------------------------------------------------------------------------------------
>
> Key: WFLY-3682
> URL: https://issues.jboss.org/browse/WFLY-3682
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Clustering
> Affects Versions: 8.1.0.Final
> Reporter: Paul Ferraro
> Assignee: Paul Ferraro
> Fix For: 8.2.0.CR1, 9.0.0.CR1
>
>
> While investigating failures in org.jboss.as.test.manualmode.ejb.client.cluster.EJBClientClusterConfigurationTestCase following the upgrade to JGroups 3.5, I uncovered a number of critical bugs in the DistributedCache logic.
> * DistributedCache uses a thread-local stack to store the reference to a Batch across invocations of Cache get/release/discard(...). Consequently, Infinispan's transaction won't commit if Cache.get(...) was called from a different thread than Cache.release(...) or Cache.discard(...)
> * The implementation of the Batch SPI uses Infinispan's BatchContainer, which itself relies on thread locals to store references to the Transaction across calls to startBatch()/endBatch().
> * Once the above issues were address, I got an NPE in InfinispanBeanEntryExternalizer.writeObject(...) when the lastAccessedTime is null (which is the case following creation).
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
11 years, 9 months
[JBoss JIRA] (WFLY-3683) ScheduledFuture#cancel(boolean) failing to cancel tasks on bean PreDestroy
by Aaron Cordova (JIRA)
[ https://issues.jboss.org/browse/WFLY-3683?page=com.atlassian.jira.plugin.... ]
Aaron Cordova updated WFLY-3683:
--------------------------------
Issue Type: Bug (was: Feature Request)
> ScheduledFuture#cancel(boolean) failing to cancel tasks on bean PreDestroy
> --------------------------------------------------------------------------
>
> Key: WFLY-3683
> URL: https://issues.jboss.org/browse/WFLY-3683
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: EE
> Affects Versions: 8.1.0.Final
> Reporter: Aaron Cordova
> Assignee: David Lloyd
>
> Calls to ScheduledFuture#cancel on bean cleanup are failing to cancel subsequent tasks.
> *NOTE* This only occurs when using the Trigger functionality. I tested the same code with scheduleAtFixedRate, and it works as expected.
> The following bean demonstrates the bug:
> {code:title=Executor.java|borderStyle=solid}
> import java.util.ArrayList;
> import java.util.Collections;
> import java.util.Date;
> import java.util.Iterator;
> import java.util.List;
> import java.util.concurrent.ScheduledFuture;
> import java.util.concurrent.TimeUnit;
> import javax.annotation.PostConstruct;
> import javax.annotation.PreDestroy;
> import javax.annotation.Resource;
> import javax.ejb.Singleton;
> import javax.ejb.Startup;
> import javax.enterprise.concurrent.LastExecution;
> import javax.enterprise.concurrent.ManagedScheduledExecutorService;
> import javax.enterprise.concurrent.Trigger;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> /**
> * Session Bean implementation class DataRecorderManagerBean
> */
> @Singleton
> @Startup
> public class ExecutorBug {
> private static final Logger LOGGER = LoggerFactory.getLogger(ExecutorBug.class);
> @Resource
> private ManagedScheduledExecutorService executorService;
> private List<ScheduledFuture<?>> scheduledTasks;
> /**
> * Default constructor.
> */
> public ExecutorBug() {
> }
> @PostConstruct
> void intialize() {
> this.scheduledTasks = Collections.synchronizedList(new ArrayList<ScheduledFuture<?>>());
> // Schedule the device task.
> PeriodicTrigger trigger = new PeriodicTrigger(0, 10, TimeUnit.SECONDS);
> ScheduledFuture<?> future = this.executorService.schedule(new LogRunner(), trigger);
> // Create the scheduled task and add it to the map.
> this.scheduledTasks.add(future);
> }
> @PreDestroy
> void cleanup() {
> // Cancel any scheduled tasks, ensuring that the map is locked.
> synchronized (this.scheduledTasks) {
> Iterator<ScheduledFuture<?>> i = this.scheduledTasks.iterator();
> while (i.hasNext()) {
> ScheduledFuture<?> future = i.next();
> // Cancel the task.
> future.cancel(true);
> }
> }
> this.scheduledTasks.clear();
> this.scheduledTasks = null;
> }
> private class LogRunner implements Runnable {
> public LogRunner() {
> }
> @Override
> public void run() {
> LOGGER.info("I am running");
> }
> }
> private class PeriodicTrigger implements Trigger {
> private final long periodMillis;
> private Date startTime;
> /**
> * Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay
> * then initialDelay+period, then initialDelay + 2 * period, and so on.
> *
> * @param initialDelay the time to delay first execution
> * @param period the period between successive executions
> * @param unit the time unit of the initialDelay and period parameters
> */
> public PeriodicTrigger(final long initialDelay, final long period, final TimeUnit unit) {
> this.periodMillis = TimeUnit.MILLISECONDS.convert(period, unit);
> // Calculate the start time.
> Date now = new Date();
> long millis = TimeUnit.MILLISECONDS.convert(initialDelay, unit);
> this.startTime = new Date(now.getTime() + millis);
> }
> @Override
> public Date getNextRunTime(final LastExecution lastExecutionInfo, final Date taskScheduledTime) {
> if (lastExecutionInfo == null) {
> return this.startTime;
> }
> else {
> return new Date(lastExecutionInfo.getScheduledStart().getTime() + this.periodMillis);
> }
> }
> @Override
> public boolean skipRun(final LastExecution lastExecutionInfo, final Date scheduledRunTime) {
> return false;
> }
> }
> }
> {code}
> Steps:
> * Deploy bean in Wildfly 8.1.0-Final using maven deploy goal.
> * Verify log statement is output.
> * Un-deploy bean from admin console.
> *Expected*
> Log statement is no longer called
> *Actual*
> Log statement continues to output after bean is destroyed.
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
11 years, 9 months
[JBoss JIRA] (WFLY-3683) ScheduledFuture#cancel(boolean) failing to cancel tasks on bean PreDestroy
by Aaron Cordova (JIRA)
[ https://issues.jboss.org/browse/WFLY-3683?page=com.atlassian.jira.plugin.... ]
Aaron Cordova updated WFLY-3683:
--------------------------------
Description:
Calls to ScheduledFuture#cancel on bean cleanup are failing to cancel subsequent tasks.
*NOTE* This only occurs when using the Trigger functionality. I tested the same code with scheduleAtFixedRate, and it works as expected.
The following bean demonstrates the bug:
{code:title=Executor.java|borderStyle=solid}
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.enterprise.concurrent.LastExecution;
import javax.enterprise.concurrent.ManagedScheduledExecutorService;
import javax.enterprise.concurrent.Trigger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Session Bean implementation class DataRecorderManagerBean
*/
@Singleton
@Startup
public class ExecutorBug {
private static final Logger LOGGER = LoggerFactory.getLogger(ExecutorBug.class);
@Resource
private ManagedScheduledExecutorService executorService;
private List<ScheduledFuture<?>> scheduledTasks;
/**
* Default constructor.
*/
public ExecutorBug() {
}
@PostConstruct
void intialize() {
this.scheduledTasks = Collections.synchronizedList(new ArrayList<ScheduledFuture<?>>());
// Schedule the device task.
PeriodicTrigger trigger = new PeriodicTrigger(0, 10, TimeUnit.SECONDS);
ScheduledFuture<?> future = this.executorService.schedule(new LogRunner(), trigger);
// Create the scheduled task and add it to the map.
this.scheduledTasks.add(future);
}
@PreDestroy
void cleanup() {
// Cancel any scheduled tasks, ensuring that the map is locked.
synchronized (this.scheduledTasks) {
Iterator<ScheduledFuture<?>> i = this.scheduledTasks.iterator();
while (i.hasNext()) {
ScheduledFuture<?> future = i.next();
// Cancel the task.
future.cancel(true);
}
}
this.scheduledTasks.clear();
this.scheduledTasks = null;
}
private class LogRunner implements Runnable {
public LogRunner() {
}
@Override
public void run() {
LOGGER.info("I am running");
}
}
private class PeriodicTrigger implements Trigger {
private final long periodMillis;
private Date startTime;
/**
* Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay
* then initialDelay+period, then initialDelay + 2 * period, and so on.
*
* @param initialDelay the time to delay first execution
* @param period the period between successive executions
* @param unit the time unit of the initialDelay and period parameters
*/
public PeriodicTrigger(final long initialDelay, final long period, final TimeUnit unit) {
this.periodMillis = TimeUnit.MILLISECONDS.convert(period, unit);
// Calculate the start time.
Date now = new Date();
long millis = TimeUnit.MILLISECONDS.convert(initialDelay, unit);
this.startTime = new Date(now.getTime() + millis);
}
@Override
public Date getNextRunTime(final LastExecution lastExecutionInfo, final Date taskScheduledTime) {
if (lastExecutionInfo == null) {
return this.startTime;
}
else {
return new Date(lastExecutionInfo.getScheduledStart().getTime() + this.periodMillis);
}
}
@Override
public boolean skipRun(final LastExecution lastExecutionInfo, final Date scheduledRunTime) {
return false;
}
}
}
{code}
Steps:
* Deploy bean in Wildfly 8.1.0-Final using maven deploy goal.
* Verify log statement is output.
* Un-deploy bean from admin console.
*Expected*
Log statement is no longer called
*Actual*
Log statement continues to output after bean is destroyed.
was:
Calls to ScheduledFuture#cancel on bean cleanup are failing to cancel subsequent tasks.
*NOTE* This only occurs when using the Trigger functionality. I tested the same code with scheduleAtFixedRate, and it works as expected.
The following bean demonstrates the bug:
{code:title=Executor.java|borderStyle=solid}
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.enterprise.concurrent.LastExecution;
import javax.enterprise.concurrent.ManagedScheduledExecutorService;
import javax.enterprise.concurrent.Trigger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Session Bean implementation class DataRecorderManagerBean
*/
@Singleton
@Startup
public class ExecutorBug {
private static final Logger LOGGER = LoggerFactory.getLogger(ExecutorBug.class);
@Resource
private ManagedScheduledExecutorService executorService;
private List<ScheduledFuture<?>> scheduledTasks;
/**
* Default constructor.
*/
public ExecutorBug() {
}
@PostConstruct
void intialize() {
this.scheduledTasks = Collections.synchronizedList(new ArrayList<ScheduledFuture<?>>());
// Schedule the device task.
PeriodicTrigger trigger = new PeriodicTrigger(0, 10, TimeUnit.SECONDS);
ScheduledFuture<?> future = this.executorService.schedule(new LogRunner(), trigger);
// Create the scheduled task and add it to the map.
this.scheduledTasks.add(future);
}
@PreDestroy
void cleanup() {
// Cancel any scheduled tasks, ensuring that the map is locked.
synchronized (this.scheduledTasks) {
Iterator<ScheduledFuture<?>> i = this.scheduledTasks.iterator();
while (i.hasNext()) {
ScheduledFuture<?> future = i.next();
// Cancel the task.
future.cancel(true);
}
}
this.scheduledTasks.clear();
this.scheduledTasks = null;
}
private class LogRunner implements Runnable {
public LogRunner() {
}
@Override
public void run() {
LOGGER.info("I am running");
}
}
private class PeriodicTrigger implements Trigger {
private final long periodMillis;
private Date startTime;
/**
* Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay
* then initialDelay+period, then initialDelay + 2 * period, and so on.
*
* @param initialDelay the time to delay first execution
* @param period the period between successive executions
* @param unit the time unit of the initialDelay and period parameters
*/
public PeriodicTrigger(final long initialDelay, final long period, final TimeUnit unit) {
this.periodMillis = TimeUnit.MILLISECONDS.convert(period, unit);
// Calculate the start time.
Date now = new Date();
long millis = TimeUnit.MILLISECONDS.convert(initialDelay, unit);
this.startTime = new Date(now.getTime() + millis);
}
@Override
public Date getNextRunTime(final LastExecution lastExecutionInfo, final Date taskScheduledTime) {
if (lastExecutionInfo == null) {
return this.startTime;
}
else {
return new Date(lastExecutionInfo.getScheduledStart().getTime() + this.periodMillis);
}
}
@Override
public boolean skipRun(final LastExecution lastExecutionInfo, final Date scheduledRunTime) {
return false;
}
}
}
{code}
Steps:
* Deploy bean in Wildfly 8.1.0-Final using maven deploy goal.
* Verify log statement is output.
* Un-deploy bean from admin console.
**Expected**
Log statement is no longer called
**Actual**
Log statement continues to output after bean is destroyed.
> ScheduledFuture#cancel(boolean) failing to cancel tasks on bean PreDestroy
> --------------------------------------------------------------------------
>
> Key: WFLY-3683
> URL: https://issues.jboss.org/browse/WFLY-3683
> Project: WildFly
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: EE
> Affects Versions: 8.1.0.Final
> Reporter: Aaron Cordova
> Assignee: David Lloyd
>
> Calls to ScheduledFuture#cancel on bean cleanup are failing to cancel subsequent tasks.
> *NOTE* This only occurs when using the Trigger functionality. I tested the same code with scheduleAtFixedRate, and it works as expected.
> The following bean demonstrates the bug:
> {code:title=Executor.java|borderStyle=solid}
> import java.util.ArrayList;
> import java.util.Collections;
> import java.util.Date;
> import java.util.Iterator;
> import java.util.List;
> import java.util.concurrent.ScheduledFuture;
> import java.util.concurrent.TimeUnit;
> import javax.annotation.PostConstruct;
> import javax.annotation.PreDestroy;
> import javax.annotation.Resource;
> import javax.ejb.Singleton;
> import javax.ejb.Startup;
> import javax.enterprise.concurrent.LastExecution;
> import javax.enterprise.concurrent.ManagedScheduledExecutorService;
> import javax.enterprise.concurrent.Trigger;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> /**
> * Session Bean implementation class DataRecorderManagerBean
> */
> @Singleton
> @Startup
> public class ExecutorBug {
> private static final Logger LOGGER = LoggerFactory.getLogger(ExecutorBug.class);
> @Resource
> private ManagedScheduledExecutorService executorService;
> private List<ScheduledFuture<?>> scheduledTasks;
> /**
> * Default constructor.
> */
> public ExecutorBug() {
> }
> @PostConstruct
> void intialize() {
> this.scheduledTasks = Collections.synchronizedList(new ArrayList<ScheduledFuture<?>>());
> // Schedule the device task.
> PeriodicTrigger trigger = new PeriodicTrigger(0, 10, TimeUnit.SECONDS);
> ScheduledFuture<?> future = this.executorService.schedule(new LogRunner(), trigger);
> // Create the scheduled task and add it to the map.
> this.scheduledTasks.add(future);
> }
> @PreDestroy
> void cleanup() {
> // Cancel any scheduled tasks, ensuring that the map is locked.
> synchronized (this.scheduledTasks) {
> Iterator<ScheduledFuture<?>> i = this.scheduledTasks.iterator();
> while (i.hasNext()) {
> ScheduledFuture<?> future = i.next();
> // Cancel the task.
> future.cancel(true);
> }
> }
> this.scheduledTasks.clear();
> this.scheduledTasks = null;
> }
> private class LogRunner implements Runnable {
> public LogRunner() {
> }
> @Override
> public void run() {
> LOGGER.info("I am running");
> }
> }
> private class PeriodicTrigger implements Trigger {
> private final long periodMillis;
> private Date startTime;
> /**
> * Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay
> * then initialDelay+period, then initialDelay + 2 * period, and so on.
> *
> * @param initialDelay the time to delay first execution
> * @param period the period between successive executions
> * @param unit the time unit of the initialDelay and period parameters
> */
> public PeriodicTrigger(final long initialDelay, final long period, final TimeUnit unit) {
> this.periodMillis = TimeUnit.MILLISECONDS.convert(period, unit);
> // Calculate the start time.
> Date now = new Date();
> long millis = TimeUnit.MILLISECONDS.convert(initialDelay, unit);
> this.startTime = new Date(now.getTime() + millis);
> }
> @Override
> public Date getNextRunTime(final LastExecution lastExecutionInfo, final Date taskScheduledTime) {
> if (lastExecutionInfo == null) {
> return this.startTime;
> }
> else {
> return new Date(lastExecutionInfo.getScheduledStart().getTime() + this.periodMillis);
> }
> }
> @Override
> public boolean skipRun(final LastExecution lastExecutionInfo, final Date scheduledRunTime) {
> return false;
> }
> }
> }
> {code}
> Steps:
> * Deploy bean in Wildfly 8.1.0-Final using maven deploy goal.
> * Verify log statement is output.
> * Un-deploy bean from admin console.
> *Expected*
> Log statement is no longer called
> *Actual*
> Log statement continues to output after bean is destroyed.
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
11 years, 9 months
[JBoss JIRA] (WFLY-3683) ScheduledFuture#cancel(boolean) failing to cancel tasks on bean PreDestroy
by Aaron Cordova (JIRA)
[ https://issues.jboss.org/browse/WFLY-3683?page=com.atlassian.jira.plugin.... ]
Aaron Cordova updated WFLY-3683:
--------------------------------
Description:
Calls to ScheduledFuture#cancel on bean cleanup are failing to cancel subsequent tasks.
*NOTE* This only occurs when using the Trigger functionality. I tested the same code with scheduleAtFixedRate, and it works as expected.
The following bean demonstrates the bug:
{code:title=Executor.java|borderStyle=solid}
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.enterprise.concurrent.LastExecution;
import javax.enterprise.concurrent.ManagedScheduledExecutorService;
import javax.enterprise.concurrent.Trigger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Session Bean implementation class DataRecorderManagerBean
*/
@Singleton
@Startup
public class ExecutorBug {
private static final Logger LOGGER = LoggerFactory.getLogger(ExecutorBug.class);
@Resource
private ManagedScheduledExecutorService executorService;
private List<ScheduledFuture<?>> scheduledTasks;
/**
* Default constructor.
*/
public ExecutorBug() {
}
@PostConstruct
void intialize() {
this.scheduledTasks = Collections.synchronizedList(new ArrayList<ScheduledFuture<?>>());
// Schedule the device task.
PeriodicTrigger trigger = new PeriodicTrigger(0, 10, TimeUnit.SECONDS);
ScheduledFuture<?> future = this.executorService.schedule(new LogRunner(), trigger);
// Create the scheduled task and add it to the map.
this.scheduledTasks.add(future);
}
@PreDestroy
void cleanup() {
// Cancel any scheduled tasks, ensuring that the map is locked.
synchronized (this.scheduledTasks) {
Iterator<ScheduledFuture<?>> i = this.scheduledTasks.iterator();
while (i.hasNext()) {
ScheduledFuture<?> future = i.next();
// Cancel the task.
future.cancel(true);
}
}
this.scheduledTasks.clear();
this.scheduledTasks = null;
}
private class LogRunner implements Runnable {
public LogRunner() {
}
@Override
public void run() {
LOGGER.info("I am running");
}
}
private class PeriodicTrigger implements Trigger {
private final long periodMillis;
private Date startTime;
/**
* Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay
* then initialDelay+period, then initialDelay + 2 * period, and so on.
*
* @param initialDelay the time to delay first execution
* @param period the period between successive executions
* @param unit the time unit of the initialDelay and period parameters
*/
public PeriodicTrigger(final long initialDelay, final long period, final TimeUnit unit) {
this.periodMillis = TimeUnit.MILLISECONDS.convert(period, unit);
// Calculate the start time.
Date now = new Date();
long millis = TimeUnit.MILLISECONDS.convert(initialDelay, unit);
this.startTime = new Date(now.getTime() + millis);
}
@Override
public Date getNextRunTime(final LastExecution lastExecutionInfo, final Date taskScheduledTime) {
if (lastExecutionInfo == null) {
return this.startTime;
}
else {
return new Date(lastExecutionInfo.getScheduledStart().getTime() + this.periodMillis);
}
}
@Override
public boolean skipRun(final LastExecution lastExecutionInfo, final Date scheduledRunTime) {
return false;
}
}
}
{code}
Steps:
* Deploy bean in Wildfly 8.1.0-Final using maven deploy goal.
* Verify log statement is output.
* Un-deploy bean from admin console.
**Expected**
Log statement is no longer called
**Actual**
Log statement continues to output after bean is destroyed.
was:
Calls to ScheduledFuture#cancel on bean cleanup are failing to cancel subsequent tasks.
*NOTE* This only occurs when using the Trigger functionality. I tested the same code with scheduleAtFixedRate, and it works as expected.
The following bean demonstrates the bug:
{code:title=Executor.java|borderStyle=solid}
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.enterprise.concurrent.LastExecution;
import javax.enterprise.concurrent.ManagedScheduledExecutorService;
import javax.enterprise.concurrent.Trigger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Session Bean implementation class DataRecorderManagerBean
*/
@Singleton
@Startup
public class ExecutorBug {
private static final Logger LOGGER = LoggerFactory.getLogger(ExecutorBug.class);
@Resource
private ManagedScheduledExecutorService executorService;
private List<ScheduledFuture<?>> scheduledTasks;
/**
* Default constructor.
*/
public ExecutorBug() {
}
@PostConstruct
void intialize() {
this.scheduledTasks = Collections.synchronizedList(new ArrayList<ScheduledFuture<?>>());
// Schedule the device task.
PeriodicTrigger trigger = new PeriodicTrigger(0, 10, TimeUnit.SECONDS);
ScheduledFuture<?> future = this.executorService.schedule(new LogRunner(), trigger);
// Create the scheduled task and add it to the map.
this.scheduledTasks.add(future);
}
@PreDestroy
void cleanup() {
// Cancel any scheduled tasks, ensuring that the map is locked.
synchronized (this.scheduledTasks) {
Iterator<ScheduledFuture<?>> i = this.scheduledTasks.iterator();
while (i.hasNext()) {
ScheduledFuture<?> future = i.next();
// Cancel the task.
future.cancel(true);
}
}
this.scheduledTasks.clear();
this.scheduledTasks = null;
}
private class LogRunner implements Runnable {
public LogRunner() {
}
@Override
public void run() {
LOGGER.info("I am running");
}
}
private class PeriodicTrigger implements Trigger {
private final long periodMillis;
private Date startTime;
/**
* Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay
* then initialDelay+period, then initialDelay + 2 * period, and so on.
*
* @param initialDelay the time to delay first execution
* @param period the period between successive executions
* @param unit the time unit of the initialDelay and period parameters
*/
public PeriodicTrigger(final long initialDelay, final long period, final TimeUnit unit) {
this.periodMillis = TimeUnit.MILLISECONDS.convert(period, unit);
// Calculate the start time.
Date now = new Date();
long millis = TimeUnit.MILLISECONDS.convert(initialDelay, unit);
this.startTime = new Date(now.getTime() + millis);
}
@Override
public Date getNextRunTime(final LastExecution lastExecutionInfo, final Date taskScheduledTime) {
if (lastExecutionInfo == null) {
return this.startTime;
}
else {
return new Date(lastExecutionInfo.getScheduledStart().getTime() + this.periodMillis);
}
}
@Override
public boolean skipRun(final LastExecution lastExecutionInfo, final Date scheduledRunTime) {
return false;
}
}
}
{code}
> ScheduledFuture#cancel(boolean) failing to cancel tasks on bean PreDestroy
> --------------------------------------------------------------------------
>
> Key: WFLY-3683
> URL: https://issues.jboss.org/browse/WFLY-3683
> Project: WildFly
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: EE
> Affects Versions: 8.1.0.Final
> Reporter: Aaron Cordova
> Assignee: David Lloyd
>
> Calls to ScheduledFuture#cancel on bean cleanup are failing to cancel subsequent tasks.
> *NOTE* This only occurs when using the Trigger functionality. I tested the same code with scheduleAtFixedRate, and it works as expected.
> The following bean demonstrates the bug:
> {code:title=Executor.java|borderStyle=solid}
> import java.util.ArrayList;
> import java.util.Collections;
> import java.util.Date;
> import java.util.Iterator;
> import java.util.List;
> import java.util.concurrent.ScheduledFuture;
> import java.util.concurrent.TimeUnit;
> import javax.annotation.PostConstruct;
> import javax.annotation.PreDestroy;
> import javax.annotation.Resource;
> import javax.ejb.Singleton;
> import javax.ejb.Startup;
> import javax.enterprise.concurrent.LastExecution;
> import javax.enterprise.concurrent.ManagedScheduledExecutorService;
> import javax.enterprise.concurrent.Trigger;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> /**
> * Session Bean implementation class DataRecorderManagerBean
> */
> @Singleton
> @Startup
> public class ExecutorBug {
> private static final Logger LOGGER = LoggerFactory.getLogger(ExecutorBug.class);
> @Resource
> private ManagedScheduledExecutorService executorService;
> private List<ScheduledFuture<?>> scheduledTasks;
> /**
> * Default constructor.
> */
> public ExecutorBug() {
> }
> @PostConstruct
> void intialize() {
> this.scheduledTasks = Collections.synchronizedList(new ArrayList<ScheduledFuture<?>>());
> // Schedule the device task.
> PeriodicTrigger trigger = new PeriodicTrigger(0, 10, TimeUnit.SECONDS);
> ScheduledFuture<?> future = this.executorService.schedule(new LogRunner(), trigger);
> // Create the scheduled task and add it to the map.
> this.scheduledTasks.add(future);
> }
> @PreDestroy
> void cleanup() {
> // Cancel any scheduled tasks, ensuring that the map is locked.
> synchronized (this.scheduledTasks) {
> Iterator<ScheduledFuture<?>> i = this.scheduledTasks.iterator();
> while (i.hasNext()) {
> ScheduledFuture<?> future = i.next();
> // Cancel the task.
> future.cancel(true);
> }
> }
> this.scheduledTasks.clear();
> this.scheduledTasks = null;
> }
> private class LogRunner implements Runnable {
> public LogRunner() {
> }
> @Override
> public void run() {
> LOGGER.info("I am running");
> }
> }
> private class PeriodicTrigger implements Trigger {
> private final long periodMillis;
> private Date startTime;
> /**
> * Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay
> * then initialDelay+period, then initialDelay + 2 * period, and so on.
> *
> * @param initialDelay the time to delay first execution
> * @param period the period between successive executions
> * @param unit the time unit of the initialDelay and period parameters
> */
> public PeriodicTrigger(final long initialDelay, final long period, final TimeUnit unit) {
> this.periodMillis = TimeUnit.MILLISECONDS.convert(period, unit);
> // Calculate the start time.
> Date now = new Date();
> long millis = TimeUnit.MILLISECONDS.convert(initialDelay, unit);
> this.startTime = new Date(now.getTime() + millis);
> }
> @Override
> public Date getNextRunTime(final LastExecution lastExecutionInfo, final Date taskScheduledTime) {
> if (lastExecutionInfo == null) {
> return this.startTime;
> }
> else {
> return new Date(lastExecutionInfo.getScheduledStart().getTime() + this.periodMillis);
> }
> }
> @Override
> public boolean skipRun(final LastExecution lastExecutionInfo, final Date scheduledRunTime) {
> return false;
> }
> }
> }
> {code}
> Steps:
> * Deploy bean in Wildfly 8.1.0-Final using maven deploy goal.
> * Verify log statement is output.
> * Un-deploy bean from admin console.
> **Expected**
> Log statement is no longer called
> **Actual**
> Log statement continues to output after bean is destroyed.
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
11 years, 9 months