Skip to content

Commit

Permalink
Merge pull request #1536 from ljacomet/issue-1535
Browse files Browse the repository at this point in the history
Fix #1535 Clean up server dependencies that leaked on client
  • Loading branch information
AbfrmBlr authored Oct 13, 2016
2 parents 4f1ef70 + c0fefa4 commit fccad07
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 19 deletions.
2 changes: 1 addition & 1 deletion clustered/common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
apply plugin: EhDeploy

dependencies {
provided "org.terracotta:entity-server-api:$parent.entityApiVersion"
provided "org.terracotta:entity-common-api:$parent.entityApiVersion"
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.terracotta.entity.EntityResponse;
import org.terracotta.entity.MessageCodec;
import org.terracotta.entity.MessageCodecException;
import org.terracotta.entity.SyncMessageCodec;

public class LockMessaging {

Expand Down Expand Up @@ -60,26 +59,10 @@ public LockTransition decodeResponse(byte[] bytes) throws MessageCodecException
}
};

private static final SyncMessageCodec<LockOperation> SYNC_CODEC = new SyncMessageCodec<LockOperation>() {
@Override
public byte[] encode(int i, LockOperation message) throws MessageCodecException {
throw new AssertionError();
}

@Override
public LockOperation decode(int i, byte[] bytes) throws MessageCodecException {
throw new AssertionError();
}
};

public static MessageCodec<LockOperation, LockTransition> codec() {
return CODEC;
}

public static SyncMessageCodec<LockOperation> syncCodec() {
return SYNC_CODEC;
}

public static LockOperation tryLock(HoldType type) {
return new LockOperation(Operation.TRY_ACQUIRE, type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.ehcache.clustered.common.internal.lock.LockMessaging.LockOperation;
import org.ehcache.clustered.common.internal.lock.LockMessaging.LockTransition;

import org.ehcache.clustered.lock.server.messages.LockSyncMessaging;
import org.terracotta.entity.ActiveServerEntity;
import org.terracotta.entity.ClientCommunicator;
import org.terracotta.entity.ConcurrencyStrategy;
Expand Down Expand Up @@ -80,7 +81,7 @@ public MessageCodec<LockOperation, LockTransition> getMessageCodec() {

@Override
public SyncMessageCodec<LockOperation> getSyncMessageCodec() {
return LockMessaging.syncCodec();
return LockSyncMessaging.syncCodec();
}

private static final <T> ServiceConfiguration<T> config(final Class<T> klazz) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright Terracotta, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.ehcache.clustered.lock.server.messages;

import org.ehcache.clustered.common.internal.lock.LockMessaging;
import org.terracotta.entity.MessageCodecException;
import org.terracotta.entity.SyncMessageCodec;

/**
* LockSyncMessaging
*/
public class LockSyncMessaging {

public static SyncMessageCodec<LockMessaging.LockOperation> syncCodec() {
return SYNC_CODEC;
}

private static final SyncMessageCodec<LockMessaging.LockOperation> SYNC_CODEC = new SyncMessageCodec<LockMessaging.LockOperation>() {
@Override
public byte[] encode(int i, LockMessaging.LockOperation message) throws MessageCodecException {
throw new AssertionError();
}

@Override
public LockMessaging.LockOperation decode(int i, byte[] bytes) throws MessageCodecException {
throw new AssertionError();
}
};

}

0 comments on commit fccad07

Please sign in to comment.