-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...urrency/src/main/java/com/github/kuangcp/queue/disruptor/first/OrderEventSlowHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.github.kuangcp.queue.disruptor.first; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
/** | ||
* @author Kuangcp | ||
* 2024-09-24 16:28 | ||
*/ | ||
@Slf4j | ||
public class OrderEventSlowHandler extends OrderEventHandler { | ||
|
||
public OrderEventSlowHandler() { | ||
} | ||
|
||
public OrderEventSlowHandler(String id) { | ||
super(id); | ||
} | ||
|
||
@Override | ||
public void onEvent(OrderEvent event, long sequence, boolean endOfBatch) { | ||
log.info("{} event: {}, sequence: {}, endOfBatch: {}", getId(), event, sequence, endOfBatch); | ||
try { | ||
TimeUnit.SECONDS.sleep(1); | ||
} catch (InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public void onEvent(OrderEvent event) { | ||
log.info("{} event: {}", getId(), event); | ||
try { | ||
TimeUnit.SECONDS.sleep(1); | ||
} catch (InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters