0

My Code as below:

 public static boolean createTopic(String topicname, String zkUrl, int sessionTimeout, int connectTimeout, int partitions, int replicationFactor){
    boolean result = false;
    ZkUtils zkUtil = ZkUtils.apply(zkUrl, connectTimeout, sessionTimeout, JaasUtils.isZkSecurityEnabled());
    RackAwareMode rackAwareMode = RackAwareMode.Enforced;

    if(AdminUtils.topicExists(zkUtil, topicname)){
        return true;
    }
    else{
        AdminUtils.createTopic(zkUtil,topicname,partitions,replicationFactor, null, null);

    }
    return result;
}

and the Scala code as below

object RackAwareMode {
   case object Disabled extends RackAwareMode
   case object Enforced extends RackAwareMode
   case object Safe extends RackAwareMode
}
sealed trait RackAwareMode

The Error arised at the line below: RackAwareMode rackAwareMode = RackAwareMode.Enforced;

Any ideas for me?

2
  • The Error is "expression expected" Commented Sep 21, 2016 at 9:56
  • 1
    Add edits to your question not via comments. Commented Sep 21, 2016 at 10:01

1 Answer 1

0

Use RackAwareMode.Enforced$.MODULE$instead. The reason is how Scala generate inner classes.

Sign up to request clarification or add additional context in comments.

1 Comment

it worked ! thank you!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.