10 December 2018

Look into JMS filestore

For many reasons sometimes is necessary to lookup JMS filestore directly, this can be achieved through:

1.
java weblogic.store.Admin

2.
storeadmin-> openfile -store FileStore-FileStore1 -dir /tmp/filestore-local

3.
storeadmin-> dump -store FileStore-FileStore1 -out /Users/German/tmp/filestore-local-dump.xml -conn -deep
4.
list -dir /tmp/filestore-local

It can be used for compressing the store as well.

more info:
https://docs.oracle.com/middleware/1221/wls/STORE/admin.htm#STORE363

06 December 2018

Ludic HTTP

418 I'm a teapot

The HTTP 418 I'm a teapot client error response code indicates that the server refuses to brew coffee because it is a teapot. This error is a reference of Hyper Text Coffee Pot Control Protocol which was an April Fools' joke in 1998

451 Unavailable For Legal Reasons:

I just discovered that HTTP status code 451 "Unavailable For Legal Reasons" exists. This number, in the 4xx "Client errors" range, is a reference to Ray Bradbury's Fahrenheit 451 in which books are illegal...

04 December 2018

WLS Shortcuts:

Useful WebLogic Server shortcuts of Admin console:


Servers -> YOUR_SERVER -> General -> Tuning -> Advanced -> Self Tuning Thread Maximum Pool Size: 400 (default)
 

Servers -> YOUR_SERVER -> Monitoring -> General : jdk, os, etc.
 

Servers -> YOUR_SERVER -> Protocols -> Channels : t3, t3s, http, https, etc.

03 December 2018

Optimizar o No Optimizar

desde el 2008.... y fines de 2018 se mantiene...

Viendo un post en el blog http://gpicon.blogspot.com/2007/11/optimizando-solucion-problema-de.html mencionan sobre optimizar y ver comentarios tan radicales como "si el problema es ficticio es una tontera optimizar", se ve varios puntos de vistas que podemos ver en la vida real.

1. si el problema no fuese ficticio entonces no trabajemos en él, entonces la mayoria de las matematicas no existirian hasta encontrarle alguna aplicacion entonces las matematicas no serian lo que son si ese fuese el paradigma (por suerte no hay tan cortos de mente en la historia de la civilización humana).

2. como sale en el triángulo de (... ver cuaderno), segun el tiempo que se le invierte podemos optimizar algun algoritmo (tarea, metodo, etc.), segun la dificultad y los tiempos (como tambien mencionan en otro post, que la Gantt siga bajo fechas estimadas),

3. hoy en dia hay varios paradigmas de metodos agiles (cual utilizo cuando desarrollo) que si el algoritmo funciona dentro de tiempos y uso de recursos razonables entonces dejemoslo ahi y vamos por otro requerimiento, despues podemos volver a optimizar y mejorar (siempre se puede), pero tenemos que terminar otras cosas antes (bueno el proyecto en si).

4. Esto me recuerda a la trilogia de articulos clasicos de Knuth (casi imposible mencionarlo), sobre la curva/transaccion de teoria versus practica, donde es dificil definir el limite hasta donde va cual paradigma y donde ambas hacen simbiosis.

Volviendo al blog inicial, creo que esos comentarios de optimizar es malo estan totalmente errados y deberian intentar meditar mejor sus dichos para poder mejorar el area de desarrollo (en todo ambito).

Creo que acá puede ser mal entendido el dicho de Knuth:

"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." (Knuth, Donald. Structured Programming with go to Statements, ACM Journal Computing Surveys, Vol 6, No. 4, Dec. 1974. p.268.).

La optimización debe ser analizada si realmente es necesaria gastar esfuerzo en algo que impacto en el rendimiento de un algoritmo ya que los cambios marginales se pueden dejar ya que sólo aumento el nivel de riesgo que se dañe lo ya logrado.

27 November 2018

Object Pooling

Object Pooling, a common question, but with not easy to find solutions :

https://stackoverflow.com/questions/43735067/manage-client-socket-pool
https://stackoverflow.com/questions/939734/tips-for-using-commons-pool-in-production
https://github.com/roma/roma-java-client/blob/master/java/client/src/main/java/jp/co/rakuten/rit/roma/client/SocketPool.java

https://commons.apache.org/proper/commons-pool/
http://www.vibur.org/vibur-object-pool/
http://danielw.cn/fast-object-pool/


CEStreamExhausted anti-pattern

This exception is thrown when EOF is found. Literally is an anti-pattern (like a goto)

https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/share/classes/sun/misc/CEStreamExhausted.java

/** This exception is thrown when EOF is reached */
public class CEStreamExhausted extends IOException { };


Which is executed at line 117 de BASE64Decoder :

https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/share/classes/sun/misc/BASE64Decoder.java

do {
   i = inStream.read();
   if (i == -1) {
      throw new CEStreamExhausted();
   }
} while (i == '\n' || i == '\r');


Therefore it's a false-positive if any APM raise it.

--------------------------------------------------------------------------------

Me faltó agregar que la clase que llama a la lanza la excepcion en cuestion es: CharacterDecoder.java

Y lo que hace es tener un loop infinito while(true) que se sale de ahi al atrapar dicha exception.

Por lo tanto queda demostrado que es un falso-positivo.

while (true) {

int length;


try {

length = decodeLinePrefix(ps, bStream);

for (i = 0; (i+bytesPerAtom()) < length; i += bytesPerAtom()) {

decodeAtom(ps, bStream, bytesPerAtom());

totalBytes += bytesPerAtom();

}

if ((i + bytesPerAtom()) == length) {

decodeAtom(ps, bStream, bytesPerAtom());

totalBytes += bytesPerAtom();

} else {

decodeAtom(ps, bStream, length - i);

totalBytes += (length - i);

}

decodeLineSuffix(ps, bStream);

} catch (CEStreamExhausted e) {

break;

}


26 November 2018

Log4j config ?

A way to check if log4j is configurated at runtime.

log4j IsConfigured ::: 

    /**
     * Returns true if it appears that log4j have been previously configured. This
     * code checks to see if there are any appenders defined for log4j which is the
     * definitive way to tell if log4j is already initialized
     */
    private static boolean isConfigured() {
        Enumeration appenders = Logger.getRoot().getAllAppenders();
        if (appenders.hasMoreElements()) {
            return true;
        } else {
            Enumeration loggers = LogManager.getCurrentLoggers();
            while (loggers.hasMoreElements()) {
                Logger c = (Logger) loggers.nextElement();
                if (c.getAllAppenders().hasMoreElements())
                    return true;
            }
        }
        return false;
    }



http://wiki.apache.org/logging-log4j/UsefulCode
http://logging.apache.org/log4j/1.2/xref-test/org/apache/log4j/defaultInit/TestCase4.html
https://web.archive.org/web/20130401061324/http://dsiutils.dsi.unimi.it/
https://web.archive.org/web/20081211154329/http://dsiutils.dsi.unimi.it/docs/it/unimi/dsi/Util.html
https://web.archive.org/web/20110303190435/http://www.screaming-penguin.com/node/7622

Blog Archive

Disclaimer

Qux