Launching a JVM with Introscope agent on a old JVM 1.7 result in :
A problem occurred while attempting to create the delegate agent [IntroscopeAgent] Agent Unavailable
Well, as the agent is heavily customized, removing customization was the first step. It starts. OK, a few lambda removing alter, I recompiled everything with Java 1.7 target.. And still the same message.
Solution :
After a hours ...
Step 1 :
Decompile
com.wily.introscope.agent.AgentShim
Add more logs, it confirms this is a class loading problem with major/minor version. I finally get the class name
Step 2 :
After checking X times my maven settings, I finally used : *
javap -v | grep version
to check if it was ok or not.
and surprisingly, the generated class was OK !
but I used also assembly plugin
Step 3 :
The cause was that I recompile some classes of an old jar and rebuild it
I tracked the faulty classes version in the different repositories The root cause was that I installed in a local repository the old jar without the modified classes with the command :
J'utilise React pour développer une application frontend et j'utilise les méthodes de base Javascsript pour gérer les événements venant du serveur ou en interne Front.
J'ai trouvé sur internet quelques fonctions utiles pour gérer les événements (je n'ai pas retrouvé où !) :
on : abonnement
off : désabonnement
trigger : déclencher un évenement
Pour mon usage, j'ai customisé ces fonctions en ajoutant une callback en paramètre. Résultat j'ai ce code :
Cela me permet de gérer des événements qui héritent de MyEvent.
Le problème est que, ce faisant, je crée une fonction anonyme à chaque souscription et que du coup il est impossible d'utiliser removeEventListener lorsque le composant se démonte.
L'idée était donc bien de garder la référence à la fonction anonyme créée (qui me permet de gérer des callbacks génériques), mais comment simplifier l'usage pour éviter de devoir faire stocker la référence à cette fonction anonyme par tous les composants ?
Eh bien en la stockant moi-même directement dans le state !
Sur le désabonnement, je vais chercher dans le state, la référence à la fonction anonyme stockée pour mon type d'événement.
function buildKey(eventType: string) {
return 'clientside-events.listener.' + eventType;
}
function on(eventType:string, state:any, listener:(detail:MyEvent) => void) {
const resultFunction = function(event:any) {
listener(event.detail)
};
document.addEventListener(eventType, resultFunction);
if (state !== null) {
if (!state.listeners) {
state.listeners = new Map();
}
state.listeners.set(buildKey(eventType), resultFunction);
}
return resultFunction;
}
function off(eventType:string, state:any) {
if (state !== null && state.listeners) {
document.removeEventListener(eventType, state.listeners.get(buildKey(eventType)));
} else {
console.warn('Trying to remove a listener but not found for ' + eventType)
}
}
function trigger(eventType:string, message:ShaanEvent) {
const event = new CustomEvent(eventType, { detail: message });
document.dispatchEvent(event);
}
export { on, off, trigger };
Sets the maximum number of OS tasks each user may run concurrently. This controls the TasksMax= setting of the per-user slice unit, see systemd.resource-control(5) for details. If assigned the special value "infinity", no tasks limit is applied. Defaults to 33%, which equals 10813 with the kernel's defaults on the host, but might be smaller in OS containers.
For my suspect PID (a lot of files) :
cat /proc/21890/status | grep Thread => 1 thread
ls /proc/21890/task | wc
confirmed by the usual command : ps -eLf | grep calrisk | wc
I have around 10805 threads running for a given JVM very close to the limit.
functionalName : a functional name for the export. I put it in the filename, nothing to do with the display
datasource : not a MatTableDataSource, just an array of object
headers : the headers, an array of string, one per column
Sort must be at this level... Because the ng-container describing the column contains mat-sort-header for sorting... So we'll pass the the sort to the generic table.
<app-hpa-table [functionalName]="'a comprehensive name for export'" [dataSource]="array of object" [headers]="an array of string" [parentSort]="sort" matSort matSortActive="weight">
A list of column definition. "name" is in the array 'headers'. Element comes from the array of objects.
The requirement was to have 3 parts in the website :
Each parts has a different menu
Each parts has a different colors for menu and header
With OceanWP, you can set for each page : menu, custom header, colors...
A bit tedious to maintain from my point of view, but works, except for Woocommerce pages, especially categories.
Solution :
As everything in wordpress works with extensions, even OceanWP andWoocommerce have their own set of paid extensions... A world of business here (as 50% of the websites run wordpress...). Paid extension could be really usefull in some cases, for my simple task, I simply do it like that :
You can copy / paste of the parent theme in the child theme to modify it
You can add custom functions
Here is the main part, as OceanWP is very customizable (to authorize paid plugins), they already have a lot of hook ready
ocean_custom_header_template : a hook to select the template
ocean_custom_menu : a hook to select the menu
Adding hook to select the right theme for Woocommerce page :
function my_custom_header_function($template) {
$result=$template;
if ( is_shop() || is_product() || is_product_category() ) {
if ('<name-of-my-slug>' == get_queried_object()->slug) {
// Exception for one category
// We have created custom OceanWP header in OceanWP Theme Library, here is the ID (shown in the URL when editing the custom header)
$result=10849;
} else {
// All others categories have another header
$result=10244;
}
}
return $result;
}
add_filter( 'ocean_custom_header_template', 'my_custom_header_function' );
And for the menu :
function my_custom_menu($menu) {
if ( is_shop() || is_product() || is_product_category() ) {
if ('<name-of-my-slug>' != get_queried_object()->slug) {
// Except for one category, I return the custom menu to display
return '493';
}
}
return $menu;
}
add_filter( 'ocean_custom_menu', 'my_custom_menu');
Well, done, not perfect but done thanks to OceanWP possible customization and Wordpress ecosystem of paid plugins.
Could be done :
Suggest a pull request to OceanWP with an GUI to select the custom header/menu for a given slug
Select the custom header in a list instead of putting direct ID...