Skip to content

Commit

Permalink
Merge branch 'CURATOR-304' of github.com:nirdothan/curator into CURAT…
Browse files Browse the repository at this point in the history
…OR-304
  • Loading branch information
randgalt committed Mar 28, 2016
2 parents 8499680 + 0b088ff commit 3d1fca2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public Response putService(ServiceInstance<T> instance, @PathParam("name") S
return Response.status(Response.Status.BAD_REQUEST).build();
}

if ( instance.getServiceType() == ServiceType.DYNAMIC )
if ( instance.getServiceType().isDynamic() )
{
log.info("Service type cannot be dynamic");
return Response.status(Response.Status.BAD_REQUEST).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@ public enum ServiceType
{
DYNAMIC,
STATIC,
PERMANENT
PERMANENT,
DYNAMIC_SEQUENTIAL;

public boolean isDynamic() {
return this == DYNAMIC || this == DYNAMIC_SEQUENTIAL;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,18 @@ protected void internalRegisterService(ServiceInstance<T> service) throws Except
{
try
{
CreateMode mode = (service.getServiceType() == ServiceType.DYNAMIC) ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT;
CreateMode mode;
switch (service.getServiceType()) {
case DYNAMIC:
mode = CreateMode.EPHEMERAL;
break;
case DYNAMIC_SEQUENTIAL:
mode = CreateMode.EPHEMERAL_SEQUENTIAL;
break;
default:
mode = CreateMode.PERSISTENT;
break;
}
client.create().creatingParentContainersIfNeeded().withMode(mode).forPath(path, bytes);
isDone = true;
}
Expand Down

0 comments on commit 3d1fca2

Please sign in to comment.