From 56e77033b6d89598c2aba6f388d7b88128a4a8c2 Mon Sep 17 00:00:00 2001 From: jwp Date: Tue, 28 Mar 2017 11:49:40 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/excutor/thread/LockSupportDisptachThread.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java index c04210c..885955e 100644 --- a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java +++ b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java @@ -42,7 +42,7 @@ public void run() { if(diff < minCycleTime && diff > 0){ try { Thread.currentThread().sleep(cycleSleepTime, (int) (diff%999999)); - } catch (Exception e) { + } catch (Throwable e) { Loggers.utilLogger.error(e.toString(), e); } } From d878de309e0af6fc5e3250fe9f33248cff338186 Mon Sep 17 00:00:00 2001 From: jwp Date: Tue, 28 Mar 2017 11:53:53 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E9=80=9A=E7=9F=A5notify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/excutor/service/UpdateService.java | 5 +++ .../game/excutor/thread/DispatchThread.java | 4 +++ .../thread/LockSupportDisptachThread.java | 36 +++++++++++-------- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java b/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java index d7d5cf7..1478300 100644 --- a/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java +++ b/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java @@ -103,6 +103,11 @@ public void start(){ this.updateMap.clear(); } + public void notifyStart(){ + iUpdateExcutor.start(); + this.updateMap.clear(); + } + public UpdateService(IUpdateExcutor iUpdateExcutor) { this.iUpdateExcutor = iUpdateExcutor; } diff --git a/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java b/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java index bcc84d4..0c2953a 100644 --- a/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java +++ b/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java @@ -21,6 +21,10 @@ public void run() { eventBus.handleEvent(); } + public void notifyRun(){ + eventBus.handleEvent(); + } + public EventBus getEventBus() { return eventBus; } diff --git a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java index 885955e..686b754 100644 --- a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java +++ b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java @@ -30,25 +30,33 @@ public LockSupportDisptachThread(EventBus eventBus, IUpdateExcutor iUpdateExcuto this.minCycleTime = minCycleTime; } + @Override public void run() { while (runningFlag) { - long time = System.nanoTime(); - int cycleSize = getEventBus().getEventsSize(); - int size = getEventBus().cycle(cycleSize); - LockSupport.park(); - - long notifyTime = System.nanoTime(); - long diff = (int) (notifyTime - time); - if(diff < minCycleTime && diff > 0){ - try { - Thread.currentThread().sleep(cycleSleepTime, (int) (diff%999999)); - } catch (Throwable e) { - Loggers.utilLogger.error(e.toString(), e); - } - } + singleCycle(); + } + } + private void singleCycle(){ + long time = System.nanoTime(); + int cycleSize = getEventBus().getEventsSize(); + int size = getEventBus().cycle(cycleSize); + LockSupport.park(); + + long notifyTime = System.nanoTime(); + long diff = (int) (notifyTime - time); + if(diff < minCycleTime && diff > 0){ + try { + Thread.currentThread().sleep(cycleSleepTime, (int) (diff%999999)); + } catch (Throwable e) { + Loggers.utilLogger.error(e.toString(), e); + } } } + @Override + public void notifyRun() { + singleCycle(); + } public void unpark(){ LockSupport.unpark(this); From 9a074d33a6cafe3ad4c0d8218958477b1f7305fc Mon Sep 17 00:00:00 2001 From: jwp Date: Tue, 28 Mar 2017 14:52:22 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E9=80=9A=E7=9F=A5notify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/excutor/service/UpdateService.java | 4 + .../game/excutor/thread/DispatchThread.java | 6 ++ .../thread/LockSupportDisptachThread.java | 30 ++++--- .../thread/SingleLockSupportUpdateThread.java | 2 +- .../asyncevent/AsyncNotifyEventTest.java | 81 +++++++++++++++++++ 5 files changed, 106 insertions(+), 17 deletions(-) create mode 100644 src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java diff --git a/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java b/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java index 1478300..10df5e8 100644 --- a/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java +++ b/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java @@ -111,4 +111,8 @@ public void notifyStart(){ public UpdateService(IUpdateExcutor iUpdateExcutor) { this.iUpdateExcutor = iUpdateExcutor; } + + public void notifyRun(){ + dispatchThread.notifyRun(); + } } diff --git a/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java b/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java index 0c2953a..eb2f5a3 100644 --- a/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java +++ b/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java @@ -4,6 +4,8 @@ import com.snowcattle.game.excutor.event.IEvent; import com.snowcattle.game.excutor.utils.Constants; +import java.util.concurrent.locks.LockSupport; + /** * Created by jiangwenping on 17/1/9. * ⌚事件分配器 @@ -47,4 +49,8 @@ public void addCreateEvent(IEvent event){ public void addFinishEvent(IEvent event){ getEventBus().addEvent(event); } + + public void unpark(){ + LockSupport.unpark(this); + } } diff --git a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java index 686b754..1ddd502 100644 --- a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java +++ b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java @@ -33,33 +33,31 @@ public LockSupportDisptachThread(EventBus eventBus, IUpdateExcutor iUpdateExcuto @Override public void run() { while (runningFlag) { - singleCycle(); + singleCycle(true); } } - private void singleCycle(){ + private void singleCycle(boolean sleepFlag){ long time = System.nanoTime(); int cycleSize = getEventBus().getEventsSize(); int size = getEventBus().cycle(cycleSize); - LockSupport.park(); - - long notifyTime = System.nanoTime(); - long diff = (int) (notifyTime - time); - if(diff < minCycleTime && diff > 0){ - try { - Thread.currentThread().sleep(cycleSleepTime, (int) (diff%999999)); - } catch (Throwable e) { - Loggers.utilLogger.error(e.toString(), e); + LockSupport.park(this); + + if(sleepFlag) { + long notifyTime = System.nanoTime(); + long diff = (int) (notifyTime - time); + if (diff < minCycleTime && diff > 0) { + try { + Thread.currentThread().sleep(cycleSleepTime, (int) (diff % 999999)); + } catch (Throwable e) { + Loggers.utilLogger.error(e.toString(), e); + } } } } @Override public void notifyRun() { - singleCycle(); - } - - public void unpark(){ - LockSupport.unpark(this); + singleCycle(false); } public EventBus getUpdateServiceEventBus() { diff --git a/src/main/java/com/snowcattle/game/excutor/thread/SingleLockSupportUpdateThread.java b/src/main/java/com/snowcattle/game/excutor/thread/SingleLockSupportUpdateThread.java index 972f2ba..29d7fc0 100644 --- a/src/main/java/com/snowcattle/game/excutor/thread/SingleLockSupportUpdateThread.java +++ b/src/main/java/com/snowcattle/game/excutor/thread/SingleLockSupportUpdateThread.java @@ -122,7 +122,7 @@ public void sendFinishList(){ sendFinish(excutorUpdate); } finishList.clear(); - LockSupport.unpark(getDispatchThread()); + getDispatchThread().unpark(); } diff --git a/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java b/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java new file mode 100644 index 0000000..4bb6605 --- /dev/null +++ b/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java @@ -0,0 +1,81 @@ +package com.snowcattle.game.excutor.event.asyncevent; + +import com.snowcattle.game.excutor.event.CycleEvent; +import com.snowcattle.game.excutor.event.EventBus; +import com.snowcattle.game.excutor.event.EventParam; +import com.snowcattle.game.excutor.event.async.IntegerUpdate; +import com.snowcattle.game.excutor.event.impl.DispatchCreateEventListener; +import com.snowcattle.game.excutor.event.impl.DispatchFinishEventListener; +import com.snowcattle.game.excutor.event.impl.DispatchUpdateEventListener; +import com.snowcattle.game.excutor.pool.UpdateEventExcutorService; +import com.snowcattle.game.excutor.service.UpdateService; +import com.snowcattle.game.excutor.thread.LockSupportEventDisptachThread; +import com.snowcattle.game.excutor.utils.Constants; + +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.TimeUnit; + +/** + * Created by jwp on 2017/3/28. + */ +public class AsyncNotifyEventTest { + public static void main(String[] args) throws Exception { + testEvent(); + } + + public static void testEvent() throws Exception { + EventBus updateEventBus = new EventBus(); +// int maxSize = 10000; +// int corePoolSize = 100; + int maxSize = 20; + int corePoolSize = 2; + long keepAliveTime = 60; + TimeUnit timeUnit = TimeUnit.SECONDS; + UpdateEventExcutorService updateEventExcutorService = new UpdateEventExcutorService(corePoolSize); + int cycleSleepTime = 1000 / Constants.cycle.cycleSize; + LockSupportEventDisptachThread dispatchThread = new LockSupportEventDisptachThread(updateEventBus, updateEventExcutorService + , cycleSleepTime, cycleSleepTime*1000); + updateEventExcutorService.setDispatchThread(dispatchThread); + UpdateService updateService = new UpdateService(dispatchThread, updateEventExcutorService); + updateEventBus.addEventListener(new DispatchCreateEventListener(dispatchThread, updateService)); + updateEventBus.addEventListener(new DispatchUpdateEventListener(dispatchThread, updateService)); + updateEventBus.addEventListener(new DispatchFinishEventListener(dispatchThread, updateService)); + + updateService.notifyStart(); + for (long i = 0; i < maxSize; i++) { + IntegerUpdate integerUpdate = new IntegerUpdate(i); + EventParam param = new EventParam(integerUpdate); + CycleEvent cycleEvent = new CycleEvent(Constants.EventTypeConstans.readyCreateEventType, integerUpdate.getId(), param); + updateService.addReadyCreateEvent(cycleEvent); + } + +// while (true){ +// Thread.currentThread().sleep(100); +// updateService.toString(); +// } +// updateService.shutDown(); + Timer timer = new Timer(); + + timer.schedule(new NotifyTask(updateService), 0, 1); + while (true) { + Thread.currentThread().sleep(100); + updateService.toString(); + } + + } +} + +class NotifyTask extends TimerTask{ + + private UpdateService updateService; + + public NotifyTask(UpdateService updateService) { + this.updateService = updateService; + } + + @Override + public void run() { + updateService.notifyRun(); + } +} From 66c91bb71ea57eeba0614cbc0b163bb60629f7c7 Mon Sep 17 00:00:00 2001 From: jwp Date: Tue, 28 Mar 2017 15:10:06 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E9=80=9A=E7=9F=A5notify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/excutor/service/UpdateService.java | 9 +------- .../game/excutor/thread/DispatchThread.java | 3 +++ .../thread/LockSupportUpdateThread.java | 4 +--- .../asyncevent/AsyncNotifyEventTest.java | 13 ----------- .../excutor/event/asyncevent/NotifyTask.java | 22 +++++++++++++++++++ 5 files changed, 27 insertions(+), 24 deletions(-) create mode 100644 src/test/java/com/snowcattle/game/excutor/event/asyncevent/NotifyTask.java diff --git a/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java b/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java index 10df5e8..005bf40 100644 --- a/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java +++ b/src/main/java/com/snowcattle/game/excutor/service/UpdateService.java @@ -35,13 +35,6 @@ public class UpdateService { //记录当前循环的更新接口 private Map updateMap = new ConcurrentHashMap(); -// public UpdateService(DispatchThread dispatchThread, EventBus eventBus, IUpdateExcutor iUpdateExcutor) { -// this.dispatchThread = dispatchThread; -// this.eventBus = eventBus; -// this.iUpdateExcutor = iUpdateExcutor; -// } - - public UpdateService(DispatchThread dispatchThread, IUpdateExcutor iUpdateExcutor) { this.dispatchThread = dispatchThread; this.iUpdateExcutor = iUpdateExcutor; @@ -57,7 +50,7 @@ public void addReadyCreateEvent(CycleEvent event){ } CreateEvent createEvent = new CreateEvent(Constants.EventTypeConstans.createEventType, eventParams); dispatchThread.addCreateEvent(createEvent); - LockSupport.unpark(dispatchThread); + dispatchThread.unpark(); } public void addReadyFinishEvent(CycleEvent event){ diff --git a/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java b/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java index eb2f5a3..a1c57f2 100644 --- a/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java +++ b/src/main/java/com/snowcattle/game/excutor/thread/DispatchThread.java @@ -53,4 +53,7 @@ public void addFinishEvent(IEvent event){ public void unpark(){ LockSupport.unpark(this); } + public void park(){ + LockSupport.park(this); + } } diff --git a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportUpdateThread.java b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportUpdateThread.java index 434fc69..795ef7b 100644 --- a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportUpdateThread.java +++ b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportUpdateThread.java @@ -32,9 +32,7 @@ public void run() { UpdateEvent event = new UpdateEvent(Constants.EventTypeConstans.updateEventType, params); event.setUpdateAliveFlag(getiUpdate().isActive()); getEventBus().addEvent(event); - - LockSupport.unpark(getDispatchThread()); - + getDispatchThread().unpark(); } } diff --git a/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java b/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java index 4bb6605..04fa927 100644 --- a/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java +++ b/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java @@ -66,16 +66,3 @@ public static void testEvent() throws Exception { } } -class NotifyTask extends TimerTask{ - - private UpdateService updateService; - - public NotifyTask(UpdateService updateService) { - this.updateService = updateService; - } - - @Override - public void run() { - updateService.notifyRun(); - } -} diff --git a/src/test/java/com/snowcattle/game/excutor/event/asyncevent/NotifyTask.java b/src/test/java/com/snowcattle/game/excutor/event/asyncevent/NotifyTask.java new file mode 100644 index 0000000..dc9000a --- /dev/null +++ b/src/test/java/com/snowcattle/game/excutor/event/asyncevent/NotifyTask.java @@ -0,0 +1,22 @@ +package com.snowcattle.game.excutor.event.asyncevent; + +import com.snowcattle.game.excutor.service.UpdateService; + +import java.util.TimerTask; + +/** + * Created by jwp on 2017/3/28. + */ +class NotifyTask extends TimerTask { + + private UpdateService updateService; + + public NotifyTask(UpdateService updateService) { + this.updateService = updateService; + } + + @Override + public void run() { + updateService.notifyRun(); + } +} From b6f6e1e57cbac136a9830993d687c222ee9a20de Mon Sep 17 00:00:00 2001 From: jwp Date: Tue, 28 Mar 2017 15:14:09 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E9=80=9A=E7=9F=A5notify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thread/LockSupportDisptachThread.java | 2 +- .../asyncevent/AsyncNotifyEventTest.java | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java index 1ddd502..45c2571 100644 --- a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java +++ b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java @@ -41,7 +41,7 @@ private void singleCycle(boolean sleepFlag){ long time = System.nanoTime(); int cycleSize = getEventBus().getEventsSize(); int size = getEventBus().cycle(cycleSize); - LockSupport.park(this); + park(); if(sleepFlag) { long notifyTime = System.nanoTime(); diff --git a/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java b/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java index 04fa927..00737c1 100644 --- a/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java +++ b/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java @@ -50,18 +50,19 @@ public static void testEvent() throws Exception { updateService.addReadyCreateEvent(cycleEvent); } -// while (true){ + while (true){ + Thread.currentThread().sleep(1000); + dispatchThread.unpark(); + updateService.notifyRun(); + } +// updateService.shutDown(); +// Timer timer = new Timer(); +// +// timer.schedule(new NotifyTask(updateService), 0, 1); +// while (true) { // Thread.currentThread().sleep(100); // updateService.toString(); // } -// updateService.shutDown(); - Timer timer = new Timer(); - - timer.schedule(new NotifyTask(updateService), 0, 1); - while (true) { - Thread.currentThread().sleep(100); - updateService.toString(); - } } } From d7fd7a043cf4e17bb7bd4b7d925ae37430da28cb Mon Sep 17 00:00:00 2001 From: jwp Date: Tue, 28 Mar 2017 15:37:36 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E9=80=9A=E7=9F=A5notify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thread/LockSupportDisptachThread.java | 3 +- .../asyncevent/AsyncNotifyEventTest.java | 33 +++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java index 45c2571..ff80b7c 100644 --- a/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java +++ b/src/main/java/com/snowcattle/game/excutor/thread/LockSupportDisptachThread.java @@ -41,9 +41,8 @@ private void singleCycle(boolean sleepFlag){ long time = System.nanoTime(); int cycleSize = getEventBus().getEventsSize(); int size = getEventBus().cycle(cycleSize); - park(); - if(sleepFlag) { + park(); long notifyTime = System.nanoTime(); long diff = (int) (notifyTime - time); if (diff < minCycleTime && diff > 0) { diff --git a/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java b/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java index 00737c1..a60ef75 100644 --- a/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java +++ b/src/test/java/com/snowcattle/game/excutor/event/asyncevent/AsyncNotifyEventTest.java @@ -15,6 +15,7 @@ import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.LockSupport; /** * Created by jwp on 2017/3/28. @@ -28,7 +29,7 @@ public static void testEvent() throws Exception { EventBus updateEventBus = new EventBus(); // int maxSize = 10000; // int corePoolSize = 100; - int maxSize = 20; + int maxSize = 2; int corePoolSize = 2; long keepAliveTime = 60; TimeUnit timeUnit = TimeUnit.SECONDS; @@ -43,6 +44,16 @@ public static void testEvent() throws Exception { updateEventBus.addEventListener(new DispatchFinishEventListener(dispatchThread, updateService)); updateService.notifyStart(); +// while (true) { +// Thread.currentThread().sleep(100); +// LockSupport.unpark(dispatchThread); +// +// LockSupport.park(dispatchThread); +// updateService.notifyRun(); +// break; +// } + + for (long i = 0; i < maxSize; i++) { IntegerUpdate integerUpdate = new IntegerUpdate(i); EventParam param = new EventParam(integerUpdate); @@ -50,20 +61,14 @@ public static void testEvent() throws Exception { updateService.addReadyCreateEvent(cycleEvent); } - while (true){ - Thread.currentThread().sleep(1000); - dispatchThread.unpark(); - updateService.notifyRun(); - } -// updateService.shutDown(); -// Timer timer = new Timer(); -// -// timer.schedule(new NotifyTask(updateService), 0, 1); -// while (true) { -// Thread.currentThread().sleep(100); -// updateService.toString(); -// } +// updateService.shutDown(); + Timer timer = new Timer(); + timer.schedule(new NotifyTask(updateService), 0, 10); + while (true) { + Thread.currentThread().sleep(100); + updateService.toString(); + } } } From e60c76ed89a3a78bac16d077fef5785a32d1c302 Mon Sep 17 00:00:00 2001 From: jwp Date: Tue, 28 Mar 2017 16:16:14 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 401088d..1f8de32 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.snowcattle.game.excutor game-excutor - 1.6.7-SNAPSHOT + 1.6.8-SNAPSHOT