Fix support for Throwable/Exceptions in Wire.

This commit is contained in:
Peter Lawrey
2015-05-20 16:39:55 +01:00
parent f231d22280
commit 8400311e9c
3 changed files with 41 additions and 51 deletions
+38 -42
View File
@@ -31,61 +31,54 @@ public class BondVOInterface$$Native
private static final int COUPON = 0;
private static final int ISSUEDATE = 8;
private static final int MATURITYDATE = 16;
private static final int ENTRY = 24;
private static final int MARKETPXINTRADAYHISTORY = 28;
private static final int MARKETPXINTRADAYHISTORY = 24;
private static final int SYMBOL = 304;
private final BondVOInterface$MarketPx$$Native _marketPxIntraDayHistory[] =
new BondVOInterface$MarketPx$$Native[7];
{
for (int i = 0; i < 7; i++)
_marketPxIntraDayHistory[i] = new BondVOInterface$MarketPx$$Native();
}
private static final int SYMBOL = 308;
private Bytes _bytes;
private long _offset;
public void setCoupon(double $) {
_bytes.writeDouble(_offset + COUPON, $);
}
public double getCoupon() {
return _bytes.readDouble(_offset + COUPON);
}
public double addAtomicCoupon(double $) {
return _bytes.addAtomicDouble(_offset + COUPON, $);
} public boolean compareAndSwapCoupon(double _1, double _2) {
return _bytes.compareAndSwapDouble(_offset + COUPON, _1, _2);
public void setCoupon(double $) {
_bytes.writeDouble(_offset + COUPON, $);
}
public void setIssueDate(long $) {
_bytes.writeLong(_offset + ISSUEDATE, $);
public double addAtomicCoupon(double $) {
return _bytes.addAtomicDouble(_offset + COUPON, $);
}
public boolean compareAndSwapCoupon(double _1, double _2) {
return _bytes.compareAndSwapDouble(_offset + COUPON, _1, _2);
}
public long getIssueDate() {
return _bytes.readLong(_offset + ISSUEDATE);
}
public void setMaturityDate(long $) {
_bytes.writeLong(_offset + MATURITYDATE, $);
public void setIssueDate(long $) {
_bytes.writeLong(_offset + ISSUEDATE, $);
}
public long getMaturityDate() {
return _bytes.readLong(_offset + MATURITYDATE);
}
public void setMaturityDate(long $) {
_bytes.writeLong(_offset + MATURITYDATE, $);
}
public long addAtomicMaturityDate(long $) {
return _bytes.addAtomicLong(_offset + MATURITYDATE, $);
} public void unlockEntry() {
_bytes.unlockInt(_offset + ENTRY);
} public void busyLockEntry() throws InterruptedException {
_bytes.busyLockInt(_offset + ENTRY);
} public void setMarketPxIntraDayHistoryAt(int i, BondVOInterface.MarketPx $) {
}
public void setMarketPxIntraDayHistoryAt(int i, BondVOInterface.MarketPx $) {
_marketPxIntraDayHistory[i].copyFrom($);
}
@@ -93,22 +86,20 @@ public class BondVOInterface$$Native
return _marketPxIntraDayHistory[i];
}
public java.lang.String getSymbol() {
return _bytes.readUTFΔ(_offset + SYMBOL);
}
public void setSymbol(java.lang.String $) {
_bytes.writeUTFΔ(_offset + SYMBOL, 20, $);
}
public java.lang.String getSymbol() {
return _bytes.readUTFΔ(_offset + SYMBOL);
}
@Override
public void copyFrom(BondVOInterface from) {
setCoupon(from.getCoupon());
setIssueDate(from.getIssueDate());
setMaturityDate(from.getMaturityDate());
for (int i = 0; i < 7; i++){
for (int i = 0; i < 7; i++) {
setMarketPxIntraDayHistoryAt(i, from.getMarketPxIntraDayHistoryAt(i));
}
setSymbol(from.getSymbol());
@@ -119,41 +110,46 @@ public class BondVOInterface$$Native
out.writeDouble(getCoupon());
out.writeLong(getIssueDate());
out.writeLong(getMaturityDate());
for (int i = 0; i < 7; i++){
for (int i = 0; i < 7; i++) {
_marketPxIntraDayHistory[i].writeMarshallable(out);
}
out.writeUTFΔ(getSymbol());
}
@Override
public void readMarshallable(Bytes in) {
setCoupon(in.readDouble());
setIssueDate(in.readLong());
setMaturityDate(in.readLong());
for (int i = 0; i < 7; i++){
for (int i = 0; i < 7; i++) {
_marketPxIntraDayHistory[i].readMarshallable(in);
}
setSymbol(in.readUTFΔ());
}
@Override
public void bytes(Bytes bytes, long offset) {
this._bytes = bytes;
this._offset = offset;
for (int i = 0; i < 7; i++){
for (int i = 0; i < 7; i++) {
((Byteable) _marketPxIntraDayHistory[i]).bytes(bytes,
_offset + MARKETPXINTRADAYHISTORY + (i * 40));
}
}
@Override
public Bytes bytes() {
return _bytes;
}
@Override
public long offset() {
return _offset;
}
@Override
public int maxSize() {
return 328;
return 324;
}
public long longHashCode_marketPxIntraDayHistory() {
@@ -182,14 +178,14 @@ public class BondVOInterface$$Native
if (!(o instanceof BondVOInterface)) return false;
BondVOInterface that = (BondVOInterface) o;
if(!isEqual(getCoupon(), that.getCoupon())) return false;
if(!isEqual(getIssueDate(), that.getIssueDate())) return false;
if(!isEqual(getMaturityDate(), that.getMaturityDate())) return false;
for (int i = 0; i <7; i++) {
if(!isEqual(getMarketPxIntraDayHistoryAt(i), that.getMarketPxIntraDayHistoryAt(i)))
if (!isEqual(getCoupon(), that.getCoupon())) return false;
if (!isEqual(getIssueDate(), that.getIssueDate())) return false;
if (!isEqual(getMaturityDate(), that.getMaturityDate())) return false;
for (int i = 0; i < 7; i++) {
if (!isEqual(getMarketPxIntraDayHistoryAt(i), that.getMarketPxIntraDayHistoryAt(i)))
return false;
}
if(!isEqual(getSymbol(), that.getSymbol())) return false;
if (!isEqual(getSymbol(), that.getSymbol())) return false;
return true;
}
-7
View File
@@ -21,13 +21,6 @@ package net.openhft.chronicle.map.fromdocs;
import net.openhft.lang.model.constraints.MaxSize;
public interface BondVOInterface {
/* add support for entry based locking */
@Deprecated()
void busyLockEntry() throws InterruptedException;
@Deprecated()
void unlockEntry();
long getIssueDate();
void setIssueDate(long issueDate); /* time in millis */
@@ -70,7 +70,8 @@ public class PingPongLockLeft {
}
private static void toggleCoupon(BondVOInterface bond, double _coupon, double _coupon2) throws InterruptedException {
for (int i = 0; ; i++) {
throw new UnsupportedOperationException();
/* for (int i = 0; ; i++) {
bond.busyLockEntry();
try {
if (bond.getCoupon() == _coupon) {
@@ -82,6 +83,6 @@ public class PingPongLockLeft {
} finally {
bond.unlockEntry();
}
}
}*/
}
}