Skip to content

Commit

Permalink
[INTERNAL] renamed threads
Browse files Browse the repository at this point in the history
Prefixed by dpp.

Change-Id: I98f334339cc72d833ab40563f8785987b4480ed4
Reviewed-on: http://saros-build.imp.fu-berlin.de/gerrit/1943
Tested-by: Jenkins CI
Reviewed-by: Stefan Rossbach <srossbach@arcor.de>
  • Loading branch information
srossbach committed Aug 31, 2014
1 parent 01c9ba6 commit 7c9bae8
Show file tree
Hide file tree
Showing 22 changed files with 179 additions and 198 deletions.
Expand Up @@ -201,7 +201,7 @@ public synchronized void configure(final String resource,
* connection attempt, currently it is only UPNP discovery
*/

ThreadUtils.runSafeAsync("SearchUPNP", LOG, new Runnable() {
ThreadUtils.runSafeAsync("dpp-upnp-resolver", LOG, new Runnable() {
@Override
public void run() {
if (upnpService != null)
Expand Down Expand Up @@ -469,7 +469,7 @@ private void initialzeNetworkComponents() {
* to the XMPP server is established
*/
if (stunService != null && stunServer != null) {
ThreadUtils.runSafeAsync("StunAddProxys", LOG, new Runnable() {
ThreadUtils.runSafeAsync("dpp-stun-discovery", LOG, new Runnable() {
@Override
public void run() {
Collection<InetSocketAddress> addresses = stunService
Expand Down
Expand Up @@ -229,7 +229,7 @@ public List<StartHandle> stop(final Collection<User> users,
final AtomicBoolean isTimeout = new AtomicBoolean(false);

for (final User user : users) {
threads.add(ThreadUtils.runSafeAsync("BlockUser-" + user + "-"
threads.add(ThreadUtils.runSafeAsync("dpp-stop-" + user + "-"
+ cause, log, new Runnable() {
@Override
public void run() {
Expand Down
Expand Up @@ -56,73 +56,70 @@ public void start() {
* dispatching listener thread when awaiting answers (could not process
* incoming messages, deadlock)
*/
ThreadUtils.runSafeAsync("Incoming whiteboard synchronization process",
log, new Runnable() {

@Override
public void run() {
try {

log.debug(prefix() + "invitation from " + peer
+ " received");

SWTUtils.runSafeSWTSync(log, new Runnable() {

@Override
public void run() {
if (!controller
.switchToConnectingState(session)) {
log.debug(prefix()
+ "Received state offer while in "
+ controller.getState() + " state");
SXEMessage msg = session.getNextMessage(
SXEMessageType.REFUSE_STATE, peer);
controller.getTransmitter().sendAsync(msg);
return;
}
ThreadUtils.runSafeAsync("dpp-wb-sync-inc", log, new Runnable() {

@Override
public void run() {
try {

log.debug(prefix() + "invitation from " + peer
+ " received");

SWTUtils.runSafeSWTSync(log, new Runnable() {

@Override
public void run() {
if (!controller.switchToConnectingState(session)) {
log.debug(prefix()
+ "Received state offer while in "
+ controller.getState() + " state");
SXEMessage msg = session.getNextMessage(
SXEMessageType.REFUSE_STATE, peer);
controller.getTransmitter().sendAsync(msg);
return;
}
});
}
});

SXEMessage msg = session.getNextMessage(
SXEMessageType.ACCEPT_STATE, peer);
SXEMessage msg = session.getNextMessage(
SXEMessageType.ACCEPT_STATE, peer);

log.debug(prefix() + "queue incoming records from now");
log.debug(prefix() + "queue incoming records from now");

final SXEMessage stateMessage = controller
.getTransmitter().sendAndAwait(
new NullProgressMonitor(), msg,
SXEMessageType.STATE);
final SXEMessage stateMessage = controller.getTransmitter()
.sendAndAwait(new NullProgressMonitor(), msg,
SXEMessageType.STATE);

if (stateMessage == null) {
log.debug(prefix()
+ "Whitebaord synchronization cancelled locally");
return;
}
if (stateMessage == null) {
log.debug(prefix()
+ "Whitebaord synchronization cancelled locally");
return;
}

log.debug(prefix() + "state received");
log.debug(prefix() + "state received");

SWTUtils.runSafeSWTSync(log, new Runnable() {
SWTUtils.runSafeSWTSync(log, new Runnable() {

@Override
public void run() {
controller.startSession(stateMessage);
}
@Override
public void run() {
controller.startSession(stateMessage);
}

});
});

// TODO send ack? Note: is not included in SXE
// TODO send ack? Note: is not included in SXE

} catch (IOException e) {
log.error(prefix()
+ "Timeout while synchronizing whiteboard state: "
+ e.getMessage());
} catch (Exception e) {
log.debug(prefix()
+ "Unexpected Exception in Whitebaord synchronization: "
+ e);
}
} catch (IOException e) {
log.error(prefix()
+ "Timeout while synchronizing whiteboard state: "
+ e.getMessage());
} catch (Exception e) {
log.debug(prefix()
+ "Unexpected Exception in Whitebaord synchronization: "
+ e);
}
});
}
});

}

Expand Down
2 changes: 1 addition & 1 deletion de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/Saros.java
Expand Up @@ -322,7 +322,7 @@ public void stop(BundleContext context) throws Exception {

try {
Thread shutdownThread = ThreadUtils.runSafeAsync(
"ShutdownProcess", log, new Runnable() { //$NON-NLS-1$
"dpp-shutdown", log, new Runnable() { //$NON-NLS-1$
@Override
public void run() {

Expand Down
16 changes: 9 additions & 7 deletions de.fu_berlin.inf.dpp/src/de/fu_berlin/inf/dpp/StartupSaros.java
Expand Up @@ -102,12 +102,14 @@ public void earlyStartup() {
|| xmppAccountStore.isEmpty())
return;

ThreadUtils.runSafeAsync("AutoConnect", log, new Runnable() {
@Override
public void run() {
connectionHandler.connect(/* avoid error popups */true);
}
});
ThreadUtils.runSafeAsync("dpp-connect-auto", log,
new Runnable() {
@Override
public void run() {
connectionHandler
.connect(/* avoid error popups */true);
}
});

}
}
Expand All @@ -125,7 +127,7 @@ public void run() {

private void startSTFController(final int port) {

ThreadUtils.runSafeAsync("STF-Controller-Starter", log, new Runnable() {
ThreadUtils.runSafeAsync("dpp-stf-startup", log, new Runnable() {
@Override
public void run() {
try {
Expand Down
Expand Up @@ -147,7 +147,7 @@ public String getSkypeURLNonBlock(final JID rqJID) {
return this.skypeNames.get(rqJID);
}

ThreadUtils.runSafeAsync("GetSkypeURL", log, new Runnable() {
ThreadUtils.runSafeAsync("dpp-skype-url-resolver", log, new Runnable() {
@Override
public void run() {
getSkypeURL(rqJID);
Expand Down
Expand Up @@ -21,15 +21,14 @@
import de.fu_berlin.inf.dpp.project.ISarosSessionManager;
import de.fu_berlin.inf.dpp.ui.dialogs.FeedbackDialog;
import de.fu_berlin.inf.dpp.ui.util.SWTUtils;
import de.fu_berlin.inf.dpp.util.ThreadUtils;

/**
* The FeedbackManager registers himself as a listener with the
* {@link ISarosSessionManager} to show a {@link FeedbackDialog} at the end of a
* session. But before he actually shows anything, it is determined from the
* global preferences if the user wants to participate in general and in which
* interval.
*
*
* @author Lisa Dohrmann
*/
@Component(module = "feedback")
Expand Down Expand Up @@ -128,7 +127,7 @@ public void stop() {
* ever wants to count the number of declined dialogs, threading
* problems must be newly considered.
*/
ThreadUtils.runSafeAsync("ShowFeedbackDialog", log, new Runnable() {
SWTUtils.runSafeSWTAsync(log, new Runnable() {

@Override
public void run() {
Expand All @@ -153,7 +152,7 @@ public FeedbackManager() {

/**
* Number of sessions until the {@link FeedbackDialog} is shown.
*
*
* @return a positive number if the value exists in the preferences or the
* default value -1
*/
Expand All @@ -165,7 +164,7 @@ public int getSessionsUntilNext() {
/**
* Sets the number of session until the next {@link FeedbackDialog} is
* shown.
*
*
* @param untilNext
*/

Expand All @@ -180,7 +179,7 @@ public static void setSessionsUntilNext(int untilNext) {

/**
* Returns whether the feedback is disabled or enabled by the user.
*
*
* @return 0 - undefined, 1 - enabled, 2 - disabled
*/
public static int getFeedbackStatus() {
Expand All @@ -191,7 +190,7 @@ public static int getFeedbackStatus() {

/**
* Returns if the feedback is disabled as a boolean.
*
*
* @return true if it is disabled
*/
public static boolean isFeedbackDisabled() {
Expand All @@ -200,7 +199,7 @@ public static boolean isFeedbackDisabled() {

/**
* Sets if the feedback is disabled or not.
*
*
* @param disabled
*/
public static void setFeedbackDisabled(final boolean disabled) {
Expand All @@ -212,7 +211,7 @@ public static void setFeedbackDisabled(final boolean disabled) {

/**
* Returns the interval in which the survey should be shown.
*
*
* @return
*/
public static int getSurveyInterval() {
Expand All @@ -222,7 +221,7 @@ public static int getSurveyInterval() {

/**
* Sets the feedback survey interval.
*
*
* @param interval
*/
public static void setSurveyInterval(final int interval) {
Expand All @@ -242,10 +241,10 @@ public static void resetSessionsUntilNextToInterval() {
* Shows the FeedbackDialog with the given message and returns whether the
* user answered it with yes or no and resets the sessions until the next
* dialog is shown.
*
*
* @param message
* @return true, if the user clicked yes, otherwise false
*
*
* @blocking
*/
public boolean showFeedbackDialog(final String message) {
Expand Down Expand Up @@ -275,7 +274,7 @@ public Boolean call() {
* <br>
* The number of sessions until the next reminder is shown is reset to the
* current interval length on every call.
*
*
* @return which browser was used to open the survey as one of the
* FeedbackManagers constants (BROWSER_EXT, BROWSER_INT or
* BROWSER_NONE)
Expand All @@ -302,7 +301,7 @@ public static int showSurvey() {

/**
* Determines from the users preferences if the survey should be shown now.
*
*
* @return true if the survey should be shown now, false otherwise
*/
public boolean showNow() {
Expand All @@ -317,7 +316,7 @@ public boolean showNow() {

/**
* Only for debugging.
*
*
* @return
*/
protected boolean debugSessionTime() {
Expand All @@ -328,7 +327,7 @@ protected boolean debugSessionTime() {

/**
* Convenience method to get a string that describes the given browser type.
*
*
* @param browserType
* @return a string that describes the browser
*/
Expand Down
Expand Up @@ -92,8 +92,8 @@ private void kickReceived(JID from) {
return;
}

stopSession(sarosSession, "Removed from the session",
user.getNickname() + " removed you from the current session.");
stopSession("Removed from the session", user.getNickname()
+ " removed you from the current session.");
}

private void leaveReceived(JID from) {
Expand Down Expand Up @@ -122,8 +122,8 @@ private void leaveReceived(JID from) {
* context which executes all incoming packets sequentially
*/
if (user.isHost()) {
stopSession(sarosSession, "Closing the session",
"Session was closed by inviter " + user.getNickname() + ".");
stopSession("Closing the session", "Session was closed by inviter "
+ user.getNickname() + ".");

}

Expand All @@ -138,7 +138,7 @@ private void leaveReceived(JID from) {
* must be run async. otherwise the user list synchronization will time
* out as we block the packet receive thread here
*/
ThreadUtils.runSafeAsync("RemoveUser-" + user, log, new Runnable() {
ThreadUtils.runSafeAsync("dpp-remove-" + user, log, new Runnable() {
@Override
public void run() {
sarosSession.removeUser(user);
Expand All @@ -147,9 +147,8 @@ public void run() {

}

private void stopSession(final ISarosSession session, final String topic,
final String reason) {
ThreadUtils.runSafeAsync("StopSessionOnHostLeave", log, new Runnable() {
private void stopSession(final String topic, final String reason) {
ThreadUtils.runSafeAsync("dpp-stop-host", log, new Runnable() {
@Override
public void run() {
sessionManager.stopSarosSession();
Expand Down
Expand Up @@ -260,8 +260,8 @@ public void start() {
if (DISPATCH_MODE == DISPATCH_MODE_ASYNC)
return;

dispatchThread = ThreadUtils.runSafeAsync("ActivityDispatcher", LOG,
dispatchThreadRunnable);
dispatchThread = ThreadUtils.runSafeAsync("dpp-activity-dispatcher",
LOG, dispatchThreadRunnable);
}

@Override
Expand Down

0 comments on commit 7c9bae8

Please sign in to comment.