Skip to content

Commit

Permalink
Merge pull request #21 from tvd12/master
Browse files Browse the repository at this point in the history
update schedule
  • Loading branch information
tvd12 authored Jul 30, 2016
2 parents 76acc13 + 863715b commit a037c98
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ We must spend a lot of time to declare, init variables. Some time we also have t
<dependency>
<groupId>com.tvd12</groupId>
<artifactId>ezyfox-core</artifactId>
<version>1.0.7</version>
<version>1.0.8</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>com.tvd12</groupId>
<artifactId>ezyfox-core</artifactId>
<version>1.0.7-SNAPSHOT</version>
<version>1.0.8-SNAPSHOT</version>
<packaging>jar</packaging>

<name>ezyfox-core</name>
Expand Down
37 changes: 32 additions & 5 deletions src/main/java/com/tvd12/ezyfox/core/command/PingClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,47 @@ public interface PingClient {
void ping();

/**
* stop schedule after done
* stop ping
*/
void stop();

/**
* stop schedule without waiting for task's done
* Indicate that the schedule is stopped or not
*
* @return true or false
*/
void stopNow();
boolean stopped();

/**
* Indicate that the schedule is stopped or not
* Attempts to cancel execution of this ping but give a change to be done
*
* @see java.util.concurrent.Future#cancel(boolean)
*
* @return true or false
*/
boolean stopped();
public boolean cancel();

/**
* Attempts to cancel execution of this ping
*
* @see java.util.concurrent.Future#cancel(boolean)
*
* @return true or false
*/
public boolean cancelNow();

/**
* @see java.util.concurrent.Future#isCancelled()
*
* @return true or false
*/
public boolean cancelled();

/**
* @see java.util.concurrent.Future#isDone()
*
* @return true or false
*/
public boolean done();

}
37 changes: 32 additions & 5 deletions src/main/java/com/tvd12/ezyfox/core/command/Schedule.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,47 @@ public interface Schedule {
public void schedule();

/**
* stop schedule after done
* stop schedule without waiting for task's done
*/
public void stop();

/**
* stop schedule without waiting for task's done
* Indicate that the schedule is stopped or not
*
* @return true or false
*/
public void stopNow();
public boolean stopped();

/**
* Indicate that the schedule is stopped or not
* Attempts to cancel execution of this task but give a change to be done
*
* @see java.util.concurrent.Future#cancel(boolean)
*
* @return true or false
*/
public boolean stopped();
public boolean cancel();

/**
* Attempts to cancel execution of this task
*
* @see java.util.concurrent.Future#cancel(boolean)
*
* @return true or false
*/
public boolean cancelNow();

/**
* @see java.util.concurrent.Future#isCancelled()
*
* @return true or false
*/
public boolean cancelled();

/**
* @see java.util.concurrent.Future#isDone()
*
* @return true or false
*/
public boolean done();

}
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,49 @@ public void schedule() {
public void stop() {
}

@Override
public void stopNow() {
}

/* (non-Javadoc)
* @see com.tvd12.ezyfox.core.command.Schedule#stopped()
*/
@Override
public boolean stopped() {
return this.stopped;
}

/* (non-Javadoc)
* @see com.tvd12.ezyfox.core.command.Schedule#cancel()
*/
@Override
public boolean cancel() {
// TODO Auto-generated method stub
return false;
}

/* (non-Javadoc)
* @see com.tvd12.ezyfox.core.command.Schedule#cancelNow()
*/
@Override
public boolean cancelNow() {
// TODO Auto-generated method stub
return false;
}

/* (non-Javadoc)
* @see com.tvd12.ezyfox.core.command.Schedule#cancelled()
*/
@Override
public boolean cancelled() {
// TODO Auto-generated method stub
return false;
}

/* (non-Javadoc)
* @see com.tvd12.ezyfox.core.command.Schedule#done()
*/
@Override
public boolean done() {
// TODO Auto-generated method stub
return false;
}

}

Expand Down Expand Up @@ -246,11 +278,6 @@ public void schedule() {

@Override
public void stop() {
executorService.shutdown();
}

@Override
public void stopNow() {
executorService.shutdownNow();
}

Expand All @@ -261,6 +288,42 @@ public void stopNow() {
public boolean stopped() {
return false;
}

/* (non-Javadoc)
* @see com.tvd12.ezyfox.core.command.Schedule#cancel()
*/
@Override
public boolean cancel() {
// TODO Auto-generated method stub
return false;
}

/* (non-Javadoc)
* @see com.tvd12.ezyfox.core.command.Schedule#cancelNow()
*/
@Override
public boolean cancelNow() {
// TODO Auto-generated method stub
return false;
}

/* (non-Javadoc)
* @see com.tvd12.ezyfox.core.command.Schedule#cancelled()
*/
@Override
public boolean cancelled() {
// TODO Auto-generated method stub
return false;
}

/* (non-Javadoc)
* @see com.tvd12.ezyfox.core.command.Schedule#done()
*/
@Override
public boolean done() {
// TODO Auto-generated method stub
return false;
}

}

Expand Down

0 comments on commit a037c98

Please sign in to comment.