Java Code Examples for java.util.Observable#deleteObserver()

The following examples show how to use java.util.Observable#deleteObserver() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SyncOnCommit.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public void update(Observable obj, Object arg) {

		if (SanityManager.DEBUG) {
			if (arg == null)
				SanityManager.THROWASSERT("still on observr list " + this);
		}

		if (arg.equals(RawTransaction.COMMIT)) {
			openContainerAndDoIt((RawTransaction) obj);
		}

		// remove this object if we are commiting, aborting or the container is being dropped
		if (arg.equals(RawTransaction.COMMIT) || arg.equals(RawTransaction.ABORT)
			|| arg.equals(identity)) {
			obj.deleteObserver(this);
		}
	}
 
Example 2
Source File: TruncateOnCommit.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public void update(Observable obj, Object arg) {
	if (SanityManager.DEBUG) {
		if (arg == null)
			SanityManager.THROWASSERT("still on observer list " + this);
	}

	if (arg.equals(RawTransaction.ABORT) ||
		arg.equals(RawTransaction.SAVEPOINT_ROLLBACK) ||
		(commitAsWell && arg.equals(RawTransaction.COMMIT))) {
		openContainerAndDoIt((RawTransaction) obj);
	}

	// remove this object if we are commiting, aborting or the container is being dropped
	if (arg.equals(RawTransaction.COMMIT) || arg.equals(RawTransaction.ABORT)
		|| arg.equals(identity)) {
		obj.deleteObserver(this);
	}
}
 
Example 3
Source File: DropOnCommit.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
	Called when the transaction is about to complete.

	@see java.util.Observer#update
*/
public void update(Observable obj, Object arg) {
	if (SanityManager.DEBUG) {
		if (arg == null)
			SanityManager.THROWASSERT("still on observr list " + this);
	}

	if (arg.equals(RawTransaction.COMMIT) || arg.equals(RawTransaction.ABORT)) {

		RawTransaction xact = (RawTransaction) obj;

		try {
			if (this.isStreamContainer)
				xact.dropStreamContainer(identity.getSegmentId(), identity.getContainerId());
			else
				xact.dropContainer(identity);
		} catch (StandardException se) {
			xact.setObserverException(se);
		}

		obj.deleteObserver(this);
	}
}
 
Example 4
Source File: SyncOnCommit.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public void update(Observable obj, Object arg) {

		if (SanityManager.DEBUG) {
			if (arg == null)
				SanityManager.THROWASSERT("still on observr list " + this);
		}

		if (arg.equals(RawTransaction.COMMIT)) {
			openContainerAndDoIt((RawTransaction) obj);
		}

		// remove this object if we are commiting, aborting or the container is being dropped
		if (arg.equals(RawTransaction.COMMIT) || arg.equals(RawTransaction.ABORT)
			|| arg.equals(identity)) {
			obj.deleteObserver(this);
		}
	}
 
Example 5
Source File: TruncateOnCommit.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
public void update(Observable obj, Object arg) {
	if (SanityManager.DEBUG) {
		if (arg == null)
			SanityManager.THROWASSERT("still on observer list " + this);
	}

	if (arg.equals(RawTransaction.ABORT) ||
		arg.equals(RawTransaction.SAVEPOINT_ROLLBACK) ||
		(commitAsWell && arg.equals(RawTransaction.COMMIT))) {
		openContainerAndDoIt((RawTransaction) obj);
	}

	// remove this object if we are commiting, aborting or the container is being dropped
	if (arg.equals(RawTransaction.COMMIT) || arg.equals(RawTransaction.ABORT)
		|| arg.equals(identity)) {
		obj.deleteObserver(this);
	}
}
 
Example 6
Source File: DropOnCommit.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
	Called when the transaction is about to complete.

	@see java.util.Observer#update
*/
public void update(Observable obj, Object arg) {
	if (SanityManager.DEBUG) {
		if (arg == null)
			SanityManager.THROWASSERT("still on observr list " + this);
	}

	if (arg.equals(RawTransaction.COMMIT) || arg.equals(RawTransaction.ABORT)) {

		RawTransaction xact = (RawTransaction) obj;

		try {
			if (this.isStreamContainer)
				xact.dropStreamContainer(identity.getSegmentId(), identity.getContainerId());
			else
				xact.dropContainer(identity);
		} catch (StandardException se) {
			xact.setObserverException(se);
		}

		obj.deleteObserver(this);
	}
}
 
Example 7
Source File: ObservableTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void update(Observable observed, Object arg) {
    ++updateCount;
    if (deleteAll)
        observed.deleteObservers();
    else
        observed.deleteObserver(this);
}
 
Example 8
Source File: SwiftOperationStopRequesterImpl.java    From swift-explorer with Apache License 2.0 4 votes vote down vote up
@Override
public void update(Observable o, Object arg) {
	stop () ;
	if (o != null)
		o.deleteObserver(this);
}