Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
Make promote and demote operation not on the managed life cycle inter…
Browse files Browse the repository at this point in the history
…face
  • Loading branch information
vietj committed Apr 2, 2013
1 parent 289bc5f commit fcf799c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,6 @@ public interface ManagedObject
*/
Throwable getFailure();

/**
* Attempt to promote the managed object.
*
* @throws IllegalStateException when reentrency is detected
*/
void promote(LifeCycleStatus to) throws IllegalStateException;

/**
* Attempt to demote the managed object.
*
* @throws IllegalStateException when reentrency is detected
*/
void demote(LifeCycleStatus to) throws IllegalStateException;

/**
* Attempt to start the managed object, same as calling <code>promote(LifeCycleStatus.STARTED)</code>.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ public final void managedStart() throws IllegalStateException
promote(LifeCycleStatus.STARTED);
}

@Override
public final synchronized void promote(LifeCycleStatus to) throws IllegalStateException
/**
* Attempt to promote the managed object.
*
* @throws IllegalStateException when reentrency is detected
*/
final synchronized void promote(LifeCycleStatus to) throws IllegalStateException
{
if (active)
{
Expand Down Expand Up @@ -194,7 +198,12 @@ public final void managedDestroy()
demote(LifeCycleStatus.INITIALIZED);
}

public final synchronized void demote(LifeCycleStatus to) throws IllegalStateException
/**
* Attempt to demote the managed object.
*
* @throws IllegalStateException when reentrency is detected
*/
final synchronized void demote(LifeCycleStatus to) throws IllegalStateException
{
if (active)
{
Expand Down

0 comments on commit fcf799c

Please sign in to comment.