| Line 193... |
Line 193... |
| 193 |
try {
|
193 |
try {
|
| 194 |
orderFetcher.startPeriodicSynch();
|
194 |
orderFetcher.startPeriodicSynch();
|
| 195 |
//log.info("Main thread sleeping.");
|
195 |
//log.info("Main thread sleeping.");
|
| 196 |
//Thread.sleep(3600000L); // = 1 hour
|
196 |
//Thread.sleep(3600000L); // = 1 hour
|
| 197 |
//log.info("Main thread awake.");
|
197 |
//log.info("Main thread awake.");
|
| 198 |
} catch (InterruptedException e) {
|
198 |
} catch (Exception e) {
|
| 199 |
log.error(e.getMessage(), e);
|
199 |
log.error(e.getMessage(), e);
|
| 200 |
//return;
|
200 |
return;
|
| 201 |
}
|
201 |
}
|
| 202 |
|
202 |
|
| 203 |
//log.info("Main thread setting keepRunning to false.");
|
203 |
//log.info("Main thread setting keepRunning to false.");
|
| 204 |
//orderFetcher.stopSynch(); // Stops the FetchOrderUpdatesJobandAcknowledge thread.
|
204 |
//orderFetcher.stopSynch(); // Stops the FetchOrderUpdatesJobandAcknowledge thread.
|
| 205 |
|
205 |
|
| Line 224... |
Line 224... |
| 224 |
try {
|
224 |
try {
|
| 225 |
df = DatatypeFactory.newInstance();
|
225 |
df = DatatypeFactory.newInstance();
|
| 226 |
} catch (DatatypeConfigurationException e) {
|
226 |
} catch (DatatypeConfigurationException e) {
|
| 227 |
log.error(e.getMessage(), e);
|
227 |
log.error(e.getMessage(), e);
|
| 228 |
}
|
228 |
}
|
| - |
|
229 |
TransactionClient tcl=null;
|
| 229 |
|
230 |
long time=0;
|
| 230 |
try {
|
231 |
try {
|
| 231 |
tcl = new TransactionClient();
|
232 |
tcl = new TransactionClient();
|
| - |
|
233 |
time = tcl.getClient().getSourceDetail(3).getLastUpdatedOn();
|
| 232 |
} catch (TException e) {
|
234 |
} catch (TException e) {
|
| 233 |
// TODO Auto-generated catch block
|
235 |
// TODO Auto-generated catch block
|
| 234 |
e.printStackTrace();
|
236 |
e.printStackTrace();
|
| 235 |
}
|
237 |
}
|
| - |
|
238 |
|
| 236 |
|
239 |
|
| 237 |
long time = tcl.getClient().getSourceDetail(3).getlastUpdatedOn();
|
240 |
GregorianCalendar Time = new GregorianCalendar();
|
| - |
|
241 |
Time.setTimeInMillis(time);
|
| 238 |
XMLGregorianCalendar startTime = df.newXMLGregorianCalendar(new GregorianCalendar().setTimeInMillis(time));
|
242 |
XMLGregorianCalendar startTime = df.newXMLGregorianCalendar(Time);
|
| 239 |
// endTime = now -2. So, startTime = now - 2 - INTERVAL_IN_MINS.
|
243 |
// endTime = now -2. So, startTime = now - 2 - INTERVAL_IN_MINS.
|
| 240 |
System.out.println("Sync job start time." + startTime.getDay() +"-"+ startTime.getMonth()+"-" + startTime.getHour()+":"+startTime.getMinute());
|
244 |
System.out.println("Sync job start time." + startTime.getDay() +"-"+ startTime.getMonth()+"-" + startTime.getHour()+":"+startTime.getMinute());
|
| 241 |
|
245 |
|
| - |
|
246 |
|
| 242 |
//startTime.add(df.newDurationDayTime(false, 0, 0, INTERVAL_IN_MINS , 0));
|
247 |
//startTime.add(df.newDurationDayTime(false, 0, 0, INTERVAL_IN_MINS , 0));
|
| 243 |
//System.out.println("Sync job start time after add .." + startTime.getDay() +"-"+ startTime.getMonth()+"-" + startTime.getHour()+":"+startTime.getMinute());
|
248 |
//System.out.println("Sync job start time after add .." + startTime.getDay() +"-"+ startTime.getMonth()+"-" + startTime.getHour()+":"+startTime.getMinute());
|
| 244 |
/*
|
249 |
/*
|
| 245 |
* This loop keeps running until the stopSynch() method is called.
|
250 |
* This loop keeps running until the stopSynch() method is called.
|
| 246 |
* stopSynch() sets keepRunning to false.
|
251 |
* stopSynch() sets keepRunning to false.
|
| Line 276... |
Line 281... |
| 276 |
XMLGregorianCalendar endTime = fetchOrderUpdatesSince(startTime);
|
281 |
XMLGregorianCalendar endTime = fetchOrderUpdatesSince(startTime);
|
| 277 |
//System.out.println("End Time is : " + endTime.getDay() +"-"+ endTime.getMonth()+"-" + endTime.getHour()+":"+endTime.getMinute());
|
282 |
//System.out.println("End Time is : " + endTime.getDay() +"-"+ endTime.getMonth()+"-" + endTime.getHour()+":"+endTime.getMinute());
|
| 278 |
//createandsubmitOrderAcknowlegementFeed();
|
283 |
//createandsubmitOrderAcknowlegementFeed();
|
| 279 |
if (endTime != null) {
|
284 |
if (endTime != null) {
|
| 280 |
startTime = endTime;
|
285 |
startTime = endTime;
|
| - |
|
286 |
|
| - |
|
287 |
try {
|
| - |
|
288 |
tcl.getClient().updateSourceDetailTimestamp(3,endTime.getMillisecond());
|
| - |
|
289 |
} catch (TException e) {
|
| 281 |
// TODO store end time in the database
|
290 |
// TODO Auto-generated catch block
|
| - |
|
291 |
e.printStackTrace();
|
| - |
|
292 |
}
|
| 282 |
} else {
|
293 |
} else {
|
| 283 |
log.info("endTime returned is null. Sleeping for "
|
294 |
log.info("endTime returned is null. Sleeping for "
|
| 284 |
+ INTERVAL_IN_MINS + " minutes.");
|
295 |
+ INTERVAL_IN_MINS + " minutes.");
|
| 285 |
try {
|
296 |
try {
|
| 286 |
Thread.sleep(INTERVAL_IN_MINS * 60L * 1000L);
|
297 |
Thread.sleep(INTERVAL_IN_MINS * 60L * 1000L);
|
| 287 |
} catch (InterruptedException e) {
|
298 |
} catch (InterruptedException e) {
|