1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Remove reply timeout from RemoteCommand

it was unused because of the value from nextResultOrThrow() was used
anyways (which uses the default of the connection instance).
This commit is contained in:
Florian Schmaus 2014-04-23 09:56:32 +02:00
parent f5276a78c2
commit c2b214f8d8

View file

@ -16,7 +16,6 @@
*/ */
package org.jivesoftware.smackx.commands; package org.jivesoftware.smackx.commands;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
@ -56,13 +55,6 @@ public class RemoteCommand extends AdHocCommand {
*/ */
private String sessionID; private String sessionID;
/**
* The number of milliseconds to wait for a response from the server
* The default value is the default packet reply timeout (5000 ms).
*/
private long packetReplyTimeout;
/** /**
* Creates a new RemoteCommand that uses an specific connection to execute a * Creates a new RemoteCommand that uses an specific connection to execute a
* command identified by <code>node</code> in the host identified by * command identified by <code>node</code> in the host identified by
@ -77,22 +69,21 @@ public class RemoteCommand extends AdHocCommand {
this.connection = connection; this.connection = connection;
this.jid = jid; this.jid = jid;
this.setNode(node); this.setNode(node);
this.packetReplyTimeout = SmackConfiguration.getDefaultPacketReplyTimeout();
} }
@Override @Override
public void cancel() throws NoResponseException, XMPPErrorException, NotConnectedException { public void cancel() throws NoResponseException, XMPPErrorException, NotConnectedException {
executeAction(Action.cancel, packetReplyTimeout); executeAction(Action.cancel);
} }
@Override @Override
public void complete(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException { public void complete(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
executeAction(Action.complete, form, packetReplyTimeout); executeAction(Action.complete, form);
} }
@Override @Override
public void execute() throws NoResponseException, XMPPErrorException, NotConnectedException { public void execute() throws NoResponseException, XMPPErrorException, NotConnectedException {
executeAction(Action.execute, packetReplyTimeout); executeAction(Action.execute);
} }
/** /**
@ -106,21 +97,21 @@ public class RemoteCommand extends AdHocCommand {
* @throws NotConnectedException * @throws NotConnectedException
*/ */
public void execute(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException { public void execute(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
executeAction(Action.execute, form, packetReplyTimeout); executeAction(Action.execute, form);
} }
@Override @Override
public void next(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException { public void next(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
executeAction(Action.next, form, packetReplyTimeout); executeAction(Action.next, form);
} }
@Override @Override
public void prev() throws NoResponseException, XMPPErrorException, NotConnectedException { public void prev() throws NoResponseException, XMPPErrorException, NotConnectedException {
executeAction(Action.prev, packetReplyTimeout); executeAction(Action.prev);
} }
private void executeAction(Action action, long packetReplyTimeout) throws NoResponseException, XMPPErrorException, NotConnectedException { private void executeAction(Action action) throws NoResponseException, XMPPErrorException, NotConnectedException {
executeAction(action, null, packetReplyTimeout); executeAction(action, null);
} }
/** /**
@ -130,12 +121,11 @@ public class RemoteCommand extends AdHocCommand {
* *
* @param action the action to execute. * @param action the action to execute.
* @param form the form with the information. * @param form the form with the information.
* @param timeout the amount of time to wait for a reply.
* @throws XMPPErrorException if there is a problem executing the command. * @throws XMPPErrorException if there is a problem executing the command.
* @throws NoResponseException if there was no response from the server. * @throws NoResponseException if there was no response from the server.
* @throws NotConnectedException * @throws NotConnectedException
*/ */
private void executeAction(Action action, Form form, long timeout) throws NoResponseException, XMPPErrorException, NotConnectedException { private void executeAction(Action action, Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
// TODO: Check that all the required fields of the form were filled, if // TODO: Check that all the required fields of the form were filled, if
// TODO: not throw the corresponding exeption. This will make a faster response, // TODO: not throw the corresponding exeption. This will make a faster response,
// TODO: since the request is stoped before it's sent. // TODO: since the request is stoped before it's sent.