Skip to content

Commit

Permalink
Added description and a couple of mgmt methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Oct 5, 2007
1 parent a6987ce commit 98feb8a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Expand Up @@ -39,6 +39,15 @@ public class OutgoingBatchService extends AbstractService implements

private IOutgoingBatchHistoryService historyService;

/**
* Create a batch and mark events as tied to that batch. We iterate through
* all the events so we can find a transaction boundary to stop on.
* <p/>
* This method is currently non-transactional because of the fear of having to deal with
* large numbers of events as part of the same batch. This shouldn't be an issue in most cases
* other than possibly leaving a batch row w/out data every now and then or leaving a batch w/out the
* associated history row.
*/
public void buildOutgoingBatches(final String nodeId) {
// TODO should channels be cached?
final List<NodeChannel> channels = configurationService.getChannelsFor(
Expand Down
Expand Up @@ -4,6 +4,9 @@
import java.io.StringWriter;
import java.util.Properties;

import javax.sql.DataSource;

import org.apache.commons.dbcp.BasicDataSource;
import org.jumpmind.symmetric.config.IRuntimeConfig;
import org.jumpmind.symmetric.service.IBootstrapService;
import org.jumpmind.symmetric.service.IPurgeService;
Expand All @@ -22,6 +25,8 @@ public class SymmetricManagementService {

private Properties properties;

private DataSource dataSource;

@ManagedOperation(description = "Run the purge process")
public void purge() {
purgeService.purge();
Expand Down Expand Up @@ -49,6 +54,20 @@ public String getExternalId() {
return runtimeConfiguration.getExternalId();
}

@ManagedAttribute(description = "Whether the basic data source is being used as the default datasource.")
public boolean isBasicDataSource() {
return dataSource instanceof BasicDataSource;
}

@ManagedAttribute(description = "If a BasicDataSource, then show the number of active connections.")
public int getNumberOfActiveConnections() {
if (isBasicDataSource()) {
return ((BasicDataSource) dataSource).getNumActive();
} else {
return -1;
}
}

public void setRuntimeConfiguration(IRuntimeConfig runtimeConfiguration) {
this.runtimeConfiguration = runtimeConfiguration;
}
Expand All @@ -64,4 +83,8 @@ public void setBootstrapService(IBootstrapService bootstrapService) {
public void setPurgeService(IPurgeService purgeService) {
this.purgeService = purgeService;
}

public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}
}
1 change: 1 addition & 0 deletions symmetric/src/main/resources/symmetric-jmx.xml
Expand Up @@ -33,6 +33,7 @@
<property name="bootstrapService" ref="bootstrapService" />
<property name="purgeService" ref="purgeService" />
<property name="properties" ref="properties" />
<property name="dataSource" ref="dataSource" />
</bean>

</beans>

0 comments on commit 98feb8a

Please sign in to comment.