mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Action Tracking Service update
Keep a record of which machine an action is currently running on, so for a cluster situation you know where you actions are git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21482 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.action;
|
package org.alfresco.repo.action;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -409,16 +411,25 @@ public class ActionTrackingServiceImpl implements ActionTrackingService
|
|||||||
*/
|
*/
|
||||||
protected static ExecutionDetails buildExecutionDetails(Action action)
|
protected static ExecutionDetails buildExecutionDetails(Action action)
|
||||||
{
|
{
|
||||||
// TODO Where are we?
|
// Where are we running?
|
||||||
String machine = "TODO";
|
if(machineName == null) {
|
||||||
|
try {
|
||||||
|
InetAddress localhost = InetAddress.getLocalHost();
|
||||||
|
machineName = localhost.getHostAddress() + " : " +
|
||||||
|
localhost.getHostName();
|
||||||
|
} catch(UnknownHostException e) {
|
||||||
|
machineName = "(machine details unavailable - server IP not known)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Generate
|
// Generate
|
||||||
return new ExecutionDetails(
|
return new ExecutionDetails(
|
||||||
buildExecutionSummary(action),
|
buildExecutionSummary(action),
|
||||||
action.getNodeRef(), machine,
|
action.getNodeRef(), machineName,
|
||||||
action.getExecutionStartDate(), false
|
action.getExecutionStartDate(), false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
private static String machineName = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns a cache key back into its constituent
|
* Turns a cache key back into its constituent
|
||||||
|
@@ -20,6 +20,7 @@ package org.alfresco.repo.action;
|
|||||||
|
|
||||||
import static org.alfresco.repo.action.ActionServiceImplTest.assertBefore;
|
import static org.alfresco.repo.action.ActionServiceImplTest.assertBefore;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.transaction.UserTransaction;
|
import javax.transaction.UserTransaction;
|
||||||
@@ -171,7 +172,12 @@ public class ActionTrackingServiceImplTest extends TestCase
|
|||||||
assertEquals(null, d.getPersistedActionRef());
|
assertEquals(null, d.getPersistedActionRef());
|
||||||
assertEquals(null, d.getStartedAt());
|
assertEquals(null, d.getStartedAt());
|
||||||
|
|
||||||
// TODO Check machine details
|
// Check the machine details
|
||||||
|
// Should be "IP : Name"
|
||||||
|
InetAddress localhost = InetAddress.getLocalHost();
|
||||||
|
String machineName = localhost.getHostAddress() + " : " +
|
||||||
|
localhost.getHostName();
|
||||||
|
assertEquals(machineName, d.getRunningOn());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Running an action gives it an execution ID */
|
/** Running an action gives it an execution ID */
|
||||||
|
Reference in New Issue
Block a user