changeset 1030:80cad9086593

remove Buffer.isVolatile()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Nov 2016 01:10:09 -0600
parents 4e5e9e3c25b3
children 921c25a05eaa
files src/org/eclipse/jetty/io/AbstractBuffer.java src/org/eclipse/jetty/io/Buffer.java src/org/eclipse/jetty/io/ByteArrayBuffer.java src/org/eclipse/jetty/io/View.java src/org/eclipse/jetty/io/nio/DirectNIOBuffer.java src/org/eclipse/jetty/io/nio/IndirectNIOBuffer.java
diffstat 6 files changed, 12 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
diff -r 4e5e9e3c25b3 -r 80cad9086593 src/org/eclipse/jetty/io/AbstractBuffer.java
--- a/src/org/eclipse/jetty/io/AbstractBuffer.java	Thu Nov 03 00:55:20 2016 -0600
+++ b/src/org/eclipse/jetty/io/AbstractBuffer.java	Thu Nov 03 01:10:09 2016 -0600
@@ -44,7 +44,6 @@
 	__VOLATILE = "VOLATILE";
 	
 	protected int _access;
-	protected boolean _volatile;
 
 	protected int _get;
 	protected int _put;
@@ -60,13 +59,12 @@
 	 * 
 	 * @param access 0==IMMUTABLE, 1==READONLY, 2==READWRITE
 	 */
-	public AbstractBuffer(int access, boolean isVolatile)
+	protected AbstractBuffer(int access)
 	{
-		if (access == IMMUTABLE && isVolatile)
-				throw new IllegalArgumentException("IMMUTABLE && VOLATILE");
+//		if (access == IMMUTABLE && isVolatile)
+//				throw new IllegalArgumentException("IMMUTABLE && VOLATILE");
 		setMarkIndex(-1);
 		_access = access;
-		_volatile = isVolatile;
 	}
 
 	/*
@@ -247,11 +245,6 @@
 		return _access <= READONLY;
 	}
 
-	public boolean isVolatile()
-	{
-		return _volatile;
-	}
-
 	public int length()
 	{
 		return _put - _get;
diff -r 4e5e9e3c25b3 -r 80cad9086593 src/org/eclipse/jetty/io/Buffer.java
--- a/src/org/eclipse/jetty/io/Buffer.java	Thu Nov 03 00:55:20 2016 -0600
+++ b/src/org/eclipse/jetty/io/Buffer.java	Thu Nov 03 01:10:09 2016 -0600
@@ -46,8 +46,6 @@
 	  IMMUTABLE=0,  // neither indexes or contexts can be changed
 	  READONLY=1,   // indexes may be changed, but not content
 	  READWRITE=2;  // anything can be changed
-	public final boolean VOLATILE=true;     // The buffer may change outside of current scope.
-	public final boolean NON_VOLATILE=false;
 
 	/**
 	 *  Get the underlying array, if one exists.
@@ -148,14 +146,6 @@
 	boolean isReadOnly();
 	
 	/**
-	 * 
-	 * @return a <code>boolean</code> value true if the buffer contents may change 
-	 * via alternate paths than this buffer.  If the contents of this buffer are to be used outside of the
-	 * current context, then a copy must be made.
-	 */
-	boolean isVolatile();
-
-	/**
 	 * The number of bytes from the getIndex to the putIndex
 	 * @return an <code>int</code> == putIndex()-getIndex()
 	 */
diff -r 4e5e9e3c25b3 -r 80cad9086593 src/org/eclipse/jetty/io/ByteArrayBuffer.java
--- a/src/org/eclipse/jetty/io/ByteArrayBuffer.java	Thu Nov 03 00:55:20 2016 -0600
+++ b/src/org/eclipse/jetty/io/ByteArrayBuffer.java	Thu Nov 03 01:10:09 2016 -0600
@@ -33,9 +33,9 @@
 	final static int MAX_WRITE=Integer.getInteger("org.eclipse.jetty.io.ByteArrayBuffer.MAX_WRITE",128*1024);
 	final protected byte[] _bytes;
 
-	protected ByteArrayBuffer(int size, int access, boolean isVolatile)
+	protected ByteArrayBuffer(int size, int access)
 	{
-		this(new byte[size],0,0,access, isVolatile);
+		this(new byte[size],0,0,access);
 	}
 	
 	public ByteArrayBuffer(byte[] bytes)
@@ -50,16 +50,7 @@
 
 	public ByteArrayBuffer(byte[] bytes, int index, int length, int access)
 	{
-		super(READWRITE, NON_VOLATILE);
-		_bytes = bytes;
-		setPutIndex(index + length);
-		setGetIndex(index);
-		_access = access;
-	}
-
-	private ByteArrayBuffer(byte[] bytes, int index, int length, int access, boolean isVolatile)
-	{
-		super(READWRITE, isVolatile);
+		super(READWRITE);
 		_bytes = bytes;
 		setPutIndex(index + length);
 		setGetIndex(index);
@@ -74,7 +65,7 @@
 
 	public ByteArrayBuffer(String value)
 	{
-		super(READWRITE,NON_VOLATILE);
+		super(READWRITE);
 		_bytes = StringUtil.getBytes(value);
 		setGetIndex(0);
 		setPutIndex(_bytes.length);
diff -r 4e5e9e3c25b3 -r 80cad9086593 src/org/eclipse/jetty/io/View.java
--- a/src/org/eclipse/jetty/io/View.java	Thu Nov 03 00:55:20 2016 -0600
+++ b/src/org/eclipse/jetty/io/View.java	Thu Nov 03 01:10:09 2016 -0600
@@ -38,7 +38,7 @@
 	 */
 	public View(Buffer buffer, int mark, int get, int put,int access)
 	{
-		super(READWRITE,!buffer.isImmutable());
+		super(READWRITE);
 		_buffer=buffer.buffer();
 		setPutIndex(put);
 		setGetIndex(get);
@@ -48,7 +48,7 @@
 	
 	public View(Buffer buffer)
 	{
-		super(READWRITE,!buffer.isImmutable());
+		super(READWRITE);
 		_buffer=buffer.buffer();
 		setPutIndex(buffer.putIndex());
 		setGetIndex(buffer.getIndex());
@@ -58,7 +58,7 @@
 
 	public View()
 	{
-		super(READWRITE,true);
+		super(READWRITE);
 	}
 	
 	/**
@@ -126,12 +126,6 @@
 	}
 
 	@Override
-	public boolean isVolatile()
-	{
-		return true;
-	}
-
-	@Override
 	public byte peek(int index)
 	{
 		return _buffer.peek(index);
diff -r 4e5e9e3c25b3 -r 80cad9086593 src/org/eclipse/jetty/io/nio/DirectNIOBuffer.java
--- a/src/org/eclipse/jetty/io/nio/DirectNIOBuffer.java	Thu Nov 03 00:55:20 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/DirectNIOBuffer.java	Thu Nov 03 01:10:09 2016 -0600
@@ -46,7 +46,7 @@
 
 	public DirectNIOBuffer(int size)
 	{
-		super(READWRITE,NON_VOLATILE);
+		super(READWRITE);
 		_buf = ByteBuffer.allocateDirect(size);
 		_buf.position(0);
 		_buf.limit(_buf.capacity());
diff -r 4e5e9e3c25b3 -r 80cad9086593 src/org/eclipse/jetty/io/nio/IndirectNIOBuffer.java
--- a/src/org/eclipse/jetty/io/nio/IndirectNIOBuffer.java	Thu Nov 03 00:55:20 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/IndirectNIOBuffer.java	Thu Nov 03 01:10:09 2016 -0600
@@ -29,7 +29,7 @@
 
 	public IndirectNIOBuffer(int size)
 	{
-		super(size,READWRITE,NON_VOLATILE);
+		super(size,READWRITE);
 		_buf = ByteBuffer.wrap(_bytes);
 		_buf.position(0);
 		_buf.limit(_buf.capacity());