Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ChronicleQueue V4, initial code for builder
- Loading branch information
1 parent
8b2f3e1
commit a63368c
Showing
5 changed files
with
137 additions
and
84 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
33 changes: 33 additions & 0 deletions
33
...le-queue/src/main/java/net/openhft/chronicle/queue/impl/AbstractChronicleQueueFormat.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
/* | |||
* Copyright (C) 2015 higherfrequencytrading.com | |||
* | |||
* This program is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Lesser General Public License as published by | |||
* the Free Software Foundation, either version 3 of the License. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
|
|||
package net.openhft.chronicle.queue.impl; | |||
|
|||
import net.openhft.chronicle.wire.WireIn; | |||
import net.openhft.chronicle.wire.WireOut; | |||
|
|||
public abstract class AbstractChronicleQueueFormat implements ChronicleQueueFormat { | |||
|
|||
@Override | |||
public void readMarshallable(WireIn wireIn) throws IllegalStateException { | |||
throw new UnsupportedOperationException("Not implemented"); | |||
} | |||
|
|||
@Override | |||
public void writeMarshallable(WireOut wireOut) { | |||
throw new UnsupportedOperationException("Not implemented"); | |||
} | |||
} |
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
99 changes: 99 additions & 0 deletions
99
...ue/src/main/java/net/openhft/chronicle/queue/impl/single/SingleChronicleQueueBuilder.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,99 @@ | |||
/* | |||
* Copyright (C) 2015 higherfrequencytrading.com | |||
* | |||
* This program is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU Lesser General Public License as published by | |||
* the Free Software Foundation, either version 3 of the License. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
|
|||
package net.openhft.chronicle.queue.impl.single; | |||
|
|||
import net.openhft.chronicle.queue.ChronicleQueue; | |||
import net.openhft.chronicle.queue.ChronicleQueueBuilder; | |||
import net.openhft.chronicle.wire.BinaryWire; | |||
import net.openhft.chronicle.wire.TextWire; | |||
import net.openhft.chronicle.wire.Wire; | |||
import org.jetbrains.annotations.NotNull; | |||
|
|||
import java.io.File; | |||
import java.io.IOException; | |||
|
|||
public class SingleChronicleQueueBuilder implements ChronicleQueueBuilder { | |||
private String name; | |||
private long blockSize; | |||
private Class<? extends Wire> wireType; | |||
|
|||
public SingleChronicleQueueBuilder(File name) { | |||
this(name.getAbsolutePath()); | |||
} | |||
|
|||
public SingleChronicleQueueBuilder(String name) { | |||
this.name = name; | |||
this.blockSize = 64L << 20; | |||
this.wireType = BinaryWire.class; | |||
} | |||
|
|||
public String name() { | |||
return this.name; | |||
} | |||
|
|||
public SingleChronicleQueueBuilder blockSize(int blockSize) { | |||
this.blockSize = blockSize; | |||
return this; | |||
} | |||
|
|||
public long blockSize() { | |||
return this.blockSize; | |||
} | |||
|
|||
public SingleChronicleQueueBuilder wireType(Class<? extends Wire> wireType) { | |||
this.wireType = wireType; | |||
return this; | |||
} | |||
|
|||
public Class<? extends Wire> wireType() { | |||
return this.wireType; | |||
} | |||
|
|||
@NotNull | |||
public ChronicleQueue build() throws IOException { | |||
throw new UnsupportedOperationException("Not yet implemented"); | |||
} | |||
|
|||
@NotNull | |||
@SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") | |||
@Override | |||
public SingleChronicleQueueBuilder clone() { | |||
try { | |||
return (SingleChronicleQueueBuilder) super.clone(); | |||
} catch (CloneNotSupportedException e) { | |||
throw new AssertionError(e); | |||
} | |||
} | |||
|
|||
public static SingleChronicleQueueBuilder binary(File name) { | |||
return binary(name.getAbsolutePath()); | |||
} | |||
|
|||
public static SingleChronicleQueueBuilder binary(String name) { | |||
return new SingleChronicleQueueBuilder(name) | |||
.wireType(BinaryWire.class); | |||
} | |||
|
|||
public static SingleChronicleQueueBuilder text(File name) { | |||
return text(name.getAbsolutePath()); | |||
} | |||
|
|||
public static SingleChronicleQueueBuilder text(String name) { | |||
return new SingleChronicleQueueBuilder(name) | |||
.wireType(TextWire.class); | |||
} | |||
} |
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