Skip to content

Commit

Permalink
Added override annotations, organized imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpeffer committed Feb 8, 2013
1 parent 9a84973 commit 62db4ac
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions src/main/java/com/surftools/BeanstalkClientImpl/ClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
* along with JavaBeanstalkCLient. If not, see <http://www.gnu.org/licenses/>.
*
*/
import java.util.List;
import java.util.Map;

import com.surftools.BeanstalkClient.BeanstalkException;
import com.surftools.BeanstalkClient.Client;
import com.surftools.BeanstalkClient.Job;
import java.util.List;
import java.util.Map;

public class ClientImpl implements Client
{
Expand Down Expand Up @@ -86,6 +85,7 @@ public ClientImpl(String host, int port, boolean useBlockIO)
// ****************************************************************
// Producer methods
// ****************************************************************
@Override
public long put(long priority, int delaySeconds, int timeToRun, byte[] data)
{
if(data == null)
Expand Down Expand Up @@ -122,6 +122,7 @@ public long put(long priority, int delaySeconds, int timeToRun, byte[] data)
return jobId;
}

@Override
public void useTube(String tubeName)
{
if(tubeName == null)
Expand All @@ -141,6 +142,7 @@ public void useTube(String tubeName)
// Consumer methods
// job-related
// ****************************************************************
@Override
public Job reserve(Integer timeoutSeconds)
{
Job job = null;
Expand Down Expand Up @@ -175,6 +177,7 @@ public Job reserve(Integer timeoutSeconds)
return job;
}

@Override
public boolean delete(long jobId)
{
Request request = new Request(
Expand All @@ -187,6 +190,7 @@ public boolean delete(long jobId)
return response != null && response.isMatchOk();
}

@Override
public boolean release(long jobId, long priority, int delaySeconds)
{
Request request = new Request(
Expand All @@ -205,6 +209,7 @@ public boolean release(long jobId, long priority, int delaySeconds)
return response != null && response.isMatchOk();
}

@Override
public boolean bury(long jobId, long priority)
{
Request request = new Request(
Expand All @@ -217,6 +222,7 @@ public boolean bury(long jobId, long priority)
return response != null && response.isMatchOk();
}

@Override
public boolean touch(long jobId)
{
Request request = new Request(
Expand All @@ -233,6 +239,7 @@ public boolean touch(long jobId)
// Consumer methods
// tube-related
// ****************************************************************
@Override
public int watch(String tubeName)
{
if(tubeName == null)
Expand All @@ -249,6 +256,7 @@ public int watch(String tubeName)
return Integer.parseInt(response.getReponse());
}

@Override
public int ignore(String tubeName)
{
if(tubeName == null)
Expand All @@ -272,6 +280,7 @@ public int ignore(String tubeName)
// Consumer methods
// peek-related
// ****************************************************************
@Override
public Job peek(long jobId)
{
Job job = null;
Expand All @@ -292,6 +301,7 @@ public Job peek(long jobId)
return job;
}

@Override
public Job peekBuried()
{
Job job = null;
Expand All @@ -312,6 +322,7 @@ public Job peekBuried()
return job;
}

@Override
public Job peekDelayed()
{
Job job = null;
Expand All @@ -332,6 +343,7 @@ public Job peekDelayed()
return job;
}

@Override
public Job peekReady()
{
Job job = null;
Expand All @@ -352,6 +364,7 @@ public Job peekReady()
return job;
}

@Override
public int kick(int count)
{
Request request = new Request(
Expand All @@ -373,6 +386,7 @@ public int kick(int count)
// stats-related
// ****************************************************************
@SuppressWarnings("unchecked")
@Override
public Map<String, String> statsJob(long jobId)
{
Request request = new Request(
Expand All @@ -391,6 +405,7 @@ public Map<String, String> statsJob(long jobId)
}

@SuppressWarnings("unchecked")
@Override
public Map<String, String> statsTube(String tubeName)
{
if(tubeName == null)
Expand All @@ -414,6 +429,7 @@ public Map<String, String> statsTube(String tubeName)
}

@SuppressWarnings("unchecked")
@Override
public Map<String, String> stats()
{
Request request = new Request(
Expand All @@ -432,6 +448,7 @@ public Map<String, String> stats()
}

@SuppressWarnings("unchecked")
@Override
public List<String> listTubes()
{
Request request = new Request(
Expand All @@ -449,6 +466,7 @@ public List<String> listTubes()
return list;
}

@Override
public String listTubeUsed()
{
String tubeName = null;
Expand All @@ -467,6 +485,7 @@ public String listTubeUsed()
}

@SuppressWarnings("unchecked")
@Override
public List<String> listTubesWatched()
{
Request request = new Request(
Expand All @@ -484,28 +503,33 @@ public List<String> listTubesWatched()
return list;
}

@Override
public String getClientVersion()
{
return VERSION;
}

@Override
public void close()
{
getProtocolHandler().close();
}

@Override
public boolean isUniqueConnectionPerThread()
{
return uniqueConnectionPerThread;
}

@Override
public void setUniqueConnectionPerThread(boolean uniqueConnectionPerThread)
{
this.uniqueConnectionPerThread = uniqueConnectionPerThread;
}

@Override
public boolean pauseTube(String tubeName, int pauseDelay) {
public boolean pauseTube(String tubeName, int pauseDelay)
{
Request request = new Request(
"pause-tube " + tubeName + " " + pauseDelay,
"PAUSED",
Expand All @@ -520,6 +544,7 @@ public boolean pauseTube(String tubeName, int pauseDelay) {
return false;
}

@Override
public String getServerVersion()
{
Map<String, String> stats = stats();
Expand Down

0 comments on commit 62db4ac

Please sign in to comment.