mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2025-08-18 18:24:56 +02:00
.config
.run
.workdir
Agent
Common
Controller
Docker
Utils
Phantom.Utils
Phantom.Utils.Actor
Event
Logging
Mailbox
IJumpAhead.cs
UnboundedJumpAheadMailbox.cs
UnboundedJumpAheadMessageQueue.cs
Tasks
ActorConfiguration.cs
ActorExtensions.cs
ActorFactory.cs
ActorRef.cs
ActorSystemFactory.cs
ICanReply.cs
Phantom.Utils.Actor.csproj
Props.cs
ReceiveActor.cs
SupervisorStrategies.cs
Phantom.Utils.Events
Phantom.Utils.Logging
Phantom.Utils.Rpc
Phantom.Utils.Tests
Web
.dockerignore
.gitattributes
.gitignore
AddMigration.bat
AddMigration.sh
Directory.Build.props
Directory.Build.targets
Dockerfile
LICENSE
Packages.props
PhantomPanel.sln
README.md
global.json
25 lines
750 B
C#
25 lines
750 B
C#
using Akka.Actor;
|
|
using Akka.Dispatch.MessageQueues;
|
|
|
|
namespace Phantom.Utils.Actor.Mailbox;
|
|
|
|
sealed class UnboundedJumpAheadMessageQueue : BlockingMessageQueue {
|
|
private readonly Queue<Envelope> highPriorityQueue = new ();
|
|
private readonly Queue<Envelope> lowPriorityQueue = new ();
|
|
|
|
protected override int LockedCount => highPriorityQueue.Count + lowPriorityQueue.Count;
|
|
|
|
protected override void LockedEnqueue(Envelope envelope) {
|
|
if (envelope.Message is IJumpAhead) {
|
|
highPriorityQueue.Enqueue(envelope);
|
|
}
|
|
else {
|
|
lowPriorityQueue.Enqueue(envelope);
|
|
}
|
|
}
|
|
|
|
protected override bool LockedTryDequeue(out Envelope envelope) {
|
|
return highPriorityQueue.TryDequeue(out envelope) || lowPriorityQueue.TryDequeue(out envelope);
|
|
}
|
|
}
|