Skip to content

Commit

Permalink
fits: remove some misleading synchronized declarations
Browse files Browse the repository at this point in the history
In ColFitsStarTable some ByteBuffer reading implementation methods
were marked synchronized and others were not.  In fact ByteBuffer
access is not thread-safe, so potential multi-thread invocations
must always be synchronized.  They are already so protected, because
the contexts in which they are invoked are already synchronized.
So remove the declarations.
  • Loading branch information
mbtaylor authored and mmpcn committed Nov 27, 2014
1 parent 51486c2 commit 54fe44e
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions fits/src/main/uk/ac/starlink/fits/ColFitsStarTable.java
Expand Up @@ -406,8 +406,7 @@ Object readValue( ByteBuffer buf, int offset ) {
info.setContentClass( boolean[].class );
return createColumnData( info, 1, itemShape, nrow, chan, pos,
new ValueReader() {
protected synchronized Object readValue( ByteBuffer buf,
int offset ) {
protected Object readValue( ByteBuffer buf, int offset ) {
buf.position( offset );
boolean[] val = new boolean[ itemSize ];
for ( int i = 0; i < itemSize; i++ ) {
Expand All @@ -422,8 +421,7 @@ else if ( formatChar == 'B' ) {
info.setContentClass( short[].class );
return createColumnData( info, 1, itemShape, nrow, chan, pos,
new ValueReader() {
protected synchronized Object readValue( ByteBuffer buf,
int offset ) {
protected Object readValue( ByteBuffer buf, int offset ) {
buf.position( offset );
short[] val = new short[ itemSize ];
for ( int i = 0; i < itemSize; i++ ) {
Expand All @@ -438,8 +436,7 @@ else if ( formatChar == 'b' ) {
info.setContentClass( short[].class );
return createColumnData( info, 1, itemShape, nrow, chan, pos,
new ValueReader() {
protected synchronized Object readValue( ByteBuffer buf,
int offset ) {
protected Object readValue( ByteBuffer buf, int offset ) {
buf.position( offset );
short[] val = new short[ itemSize ];
for ( int i = 0; i < itemSize; i++ ) {
Expand All @@ -454,8 +451,7 @@ else if ( formatChar == 'I' ) {
info.setContentClass( short[].class );
return createColumnData( info, 2, itemShape, nrow, chan, pos,
new ValueReader() {
protected synchronized Object readValue( ByteBuffer buf,
int offset ) {
protected Object readValue( ByteBuffer buf, int offset ) {
buf.position( offset );
short[] val = new short[ itemSize ];
for ( int i = 0; i < itemSize; i++ ) {
Expand All @@ -470,8 +466,7 @@ else if ( formatChar == 'J' ) {
info.setContentClass( int[].class );
return createColumnData( info, 4, itemShape, nrow, chan, pos,
new ValueReader() {
protected synchronized Object readValue( ByteBuffer buf,
int offset ) {
protected Object readValue( ByteBuffer buf, int offset ) {
buf.position( offset );
int[] val = new int[ itemSize ];
for ( int i = 0; i < itemSize; i++ ) {
Expand All @@ -486,8 +481,7 @@ else if ( formatChar == 'K' ) {
info.setContentClass( long[].class );
return createColumnData( info, 8, itemShape, nrow, chan, pos,
new ValueReader() {
protected synchronized Object readValue( ByteBuffer buf,
int offset ) {
protected Object readValue( ByteBuffer buf, int offset ) {
buf.position( offset );
long[] val = new long[ itemSize ];
for ( int i = 0; i < itemSize; i++ ) {
Expand All @@ -502,8 +496,7 @@ else if ( formatChar == 'E' ) {
info.setContentClass( float[].class );
return createColumnData( info, 4, itemShape, nrow, chan, pos,
new ValueReader() {
protected synchronized Object readValue( ByteBuffer buf,
int offset ) {
protected Object readValue( ByteBuffer buf, int offset ) {
buf.position( offset );
float[] val = new float[ itemSize ];
for ( int i = 0; i < itemSize; i++ ) {
Expand All @@ -518,8 +511,7 @@ else if ( formatChar == 'D' ) {
info.setContentClass( double[].class );
return createColumnData( info, 8, itemShape, nrow, chan, pos,
new ValueReader() {
protected synchronized Object readValue( ByteBuffer buf,
int offset ) {
protected Object readValue( ByteBuffer buf, int offset ) {
buf.position( offset );
double[] val = new double[ itemSize ];
for ( int i = 0; i < itemSize; i++ ) {
Expand All @@ -540,8 +532,8 @@ else if ( formatChar == 'A' ) {
return createColumnData( info, sleng, SCALAR, nrow,
chan, pos,
new ValueReader() {
protected synchronized Object readValue( ByteBuffer buf,
int offset ) {
protected Object readValue( ByteBuffer buf,
int offset ) {
buf.position( offset );
int iend = 0;
boolean end = false;
Expand Down Expand Up @@ -572,8 +564,8 @@ protected synchronized Object readValue( ByteBuffer buf,
return createColumnData( info, sleng, sshape, nrow,
chan, pos,
new ValueReader() {
protected synchronized Object readValue( ByteBuffer buf,
int offset ) {
protected Object readValue( ByteBuffer buf,
int offset ) {
buf.position( offset );
String[] val = new String[ nstring ];
for ( int is = 0; is < nstring; is++ ) {
Expand Down

0 comments on commit 54fe44e

Please sign in to comment.