0

I am a Cassandra newbie and I am encountering an issue regarding the object-mapping API.

I have a mapped class like this:

@Table(keyspace = "analytics", name = "events")
public class CassandraEventRecord {

@PartitionKey
private String id;
private String name;
private Date startTime;
private Date endTime;
private Map<String, Object> parameters;

public CassandraEventRecord() {
}

public CassandraEventRecord(EventRecord record) {

    this.id = record.getId();
    this.name = record.getName();
    this.startTime = record.getStartTime();
    this.endTime = record.getEndTime();
    this.parameters = record.getParameters();
}

/**
 * @return the id
 */
public String getId() {
    return id;
}

/**
 * @param id the id to set
 */
public void setId(String id) {
    this.id = id;
}

/**
 * @return the name
 */
public String getName() {
    return name;
}

/**
 * @param name the name to set
 */
public void setName(String name) {
    this.name = name;
}

/**
 * @return the startTime
 */
public Date getStartTime() {
    return startTime;
}

/**
 * @param startTime the startTime to set
 */
public void setStartTime(Date startTime) {
    this.startTime = startTime;
}

/**
 * @return the endTime
 */
public Date getEndTime() {
    return endTime;
}

/**
 * @param endTime the endTime to set
 */
public void setEndTime(Date endTime) {
    this.endTime = endTime;
}

/**
 * @return the parameters
 */
public Map<String, Object> getParameters() {
    return parameters;
}

/**
 * @param parameters the parameters to set
 */
public void setParameters(Map<String, Object> parameters) {
    this.parameters = parameters;
}

Cassandra is running embedded in OSGi. I am using Java 7 on Windows 8.1.

Mapper<CassandraEventRecord> mapper = manager.mapper(CassandraEventRecord.class);

CassandraEventRecord cassandraEventRecord = new CassandraEventRecord(eventRecord);

mapper.saveAsync(cassandraEventRecord);

Record is not saved and there is no exception. After investigating further, my code is stuck at the line that mapper is retrieved as statements after manager.mapper(...) is never executed.

Insert queries built with QueryBuilder are working but not mapping. What is wrong? Do you have any idea?

Edit: Here's the stack trace

Deniz Acay
  • 1,609
  • 1
  • 13
  • 24
  • can you include the full stack trace of where the code is stuck? – Andy Tolbert Mar 04 '15 at 23:02
  • @AndyTolbert How? I can't debug the OSGi environment and no exceptions are thrown. Do you have any advice? – Deniz Acay Mar 04 '15 at 23:06
  • 2
    You can use jstack (http://docs.oracle.com/javase/7/docs/technotes/tools/share/jstack.html - included with the java JDK). Identify the process id of your java process using Task Manager in Windows, and then open up a command prompt and do jstack pid (where pid is your process id). – Andy Tolbert Mar 04 '15 at 23:09
  • 2
    I also believe that in windows you can to CTRL + BREAK if your java application is running in a command prompt window to print the stack trace. – Andy Tolbert Mar 04 '15 at 23:10
  • Thank you for guidance. Here's the stack trace: https://www.dropbox.com/s/h80r5kherwa0al6/stack.log?dl=0 Looks like all Cassandra threads are waiting. Multithreading problems? – Deniz Acay Mar 05 '15 at 18:08
  • I doesn't look like there is anything blocked/waiting from what I can tell. Do you know what thread your code happens to be executing in where it gets stuck? – Andy Tolbert Mar 05 '15 at 19:10

0 Answers0